-
Notifications
You must be signed in to change notification settings - Fork 172
Expand file tree
/
Copy pathdocker-entrypoint.sh
More file actions
30 lines (26 loc) · 898 Bytes
/
docker-entrypoint.sh
File metadata and controls
30 lines (26 loc) · 898 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/bin/sh
set -e
# Architecture: x64 or arm64
# Only set CODEX_ARCH if it's not already set or is empty
if [ -z "${CODEX_ARCH}" ]; then
UNAME_ARCH=$(uname -m)
if [ "$UNAME_ARCH" = "aarch64" ]; then
CODEX_ARCH="arm64"
elif [ "$UNAME_ARCH" = "x86_64" ]; then
CODEX_ARCH="x64"
else
CODEX_ARCH="$UNAME_ARCH"
fi
export CODEX_ARCH
fi
# Seed empty config bind mount with defaults from the image
if [ -d /defaults ] && [ -z "$(ls -A /app/config 2>/dev/null)" ]; then
echo "[Init] Config directory is empty — seeding from image defaults"
mkdir -p /app/config
cp -r /defaults/* /app/config/
fi
# Ensure mounted volumes are writable by the node user (UID 1000).
# When Docker auto-creates bind-mount directories on the host,
# they default to root:root — the node user can't write to them.
chown -R node:node /app/data /app/config 2>/dev/null || true
exec gosu node "$@"