Spaces:
Paused
Paused
icebear0828 Claude Opus 4.6 commited on
Commit Β·
701ca45
1
Parent(s): 9c91ebe
fix: Docker build installs curl, keeps tsx, optimizes layers
Browse files- Add curl to apt-get (needed by setup-curl.ts and full-update.ts)
- Re-add tsx after prune (needed at runtime by update-checker fork)
- Separate web deps layer for better cache efficiency
- Add env_file to docker-compose.yml for .env pass-through
- Default .env.example to linux/x64 for Docker users
- Expand .dockerignore to exclude .env*, *.md, scripts/poc-*
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- .dockerignore +3 -0
- .env.example +3 -16
- Dockerfile +19 -15
- docker-compose.yml +3 -11
.dockerignore
CHANGED
|
@@ -7,4 +7,7 @@ tmp/
|
|
| 7 |
.git/
|
| 8 |
docs/
|
| 9 |
stitch-*/
|
|
|
|
| 10 |
.env
|
|
|
|
|
|
|
|
|
| 7 |
.git/
|
| 8 |
docs/
|
| 9 |
stitch-*/
|
| 10 |
+
*.md
|
| 11 |
.env
|
| 12 |
+
.env.*
|
| 13 |
+
scripts/poc-*
|
.env.example
CHANGED
|
@@ -1,17 +1,4 @@
|
|
| 1 |
-
#
|
| 2 |
-
#
|
| 3 |
-
|
| 4 |
-
# ββ Authentication ββ
|
| 5 |
-
CODEX_JWT_TOKEN= # Optional: paste ChatGPT JWT directly (skip OAuth)
|
| 6 |
-
|
| 7 |
-
# ββ Platform (for fingerprint headers) ββ
|
| 8 |
-
CODEX_PLATFORM=darwin # darwin/win32/linux
|
| 9 |
-
CODEX_ARCH=arm64 # arm64/x64
|
| 10 |
-
|
| 11 |
-
# ββ Port ββ
|
| 12 |
PORT=8080
|
| 13 |
-
|
| 14 |
-
# ββ Docker runtime proxy ββ
|
| 15 |
-
# The container needs a proxy to reach chatgpt.com.
|
| 16 |
-
# host.docker.internal resolves to the Docker host machine.
|
| 17 |
-
# CONTAINER_PROXY=http://host.docker.internal:7890
|
|
|
|
| 1 |
+
CODEX_JWT_TOKEN= # Optional: paste ChatGPT JWT (skip OAuth login)
|
| 2 |
+
CODEX_PLATFORM=linux # linux for Docker, darwin for macOS, win32 for Windows
|
| 3 |
+
CODEX_ARCH=x64 # x64 for Docker/Intel, arm64 for Apple Silicon
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
PORT=8080
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Dockerfile
CHANGED
|
@@ -1,30 +1,34 @@
|
|
| 1 |
FROM node:20-slim
|
| 2 |
|
| 3 |
-
#
|
|
|
|
| 4 |
RUN apt-get update && \
|
| 5 |
-
apt-get install -y --no-install-recommends
|
| 6 |
rm -rf /var/lib/apt/lists/*
|
| 7 |
|
| 8 |
WORKDIR /app
|
| 9 |
|
| 10 |
-
#
|
| 11 |
-
COPY . .
|
| 12 |
-
|
| 13 |
-
# Install backend dependencies (postinstall downloads curl-impersonate)
|
| 14 |
RUN npm ci
|
| 15 |
|
| 16 |
-
#
|
| 17 |
-
RUN
|
|
|
|
| 18 |
|
| 19 |
-
#
|
| 20 |
-
|
|
|
|
| 21 |
|
| 22 |
-
#
|
| 23 |
-
|
| 24 |
|
| 25 |
-
#
|
| 26 |
-
|
| 27 |
|
| 28 |
-
|
|
|
|
| 29 |
|
|
|
|
|
|
|
| 30 |
CMD ["node", "dist/index.js"]
|
|
|
|
| 1 |
FROM node:20-slim
|
| 2 |
|
| 3 |
+
# curl: needed by setup-curl.ts and full-update.ts
|
| 4 |
+
# unzip: needed by full-update.ts to extract Codex.app
|
| 5 |
RUN apt-get update && \
|
| 6 |
+
apt-get install -y --no-install-recommends curl unzip ca-certificates && \
|
| 7 |
rm -rf /var/lib/apt/lists/*
|
| 8 |
|
| 9 |
WORKDIR /app
|
| 10 |
|
| 11 |
+
# 1) Backend deps (postinstall downloads curl-impersonate for Linux)
|
| 12 |
+
COPY package*.json ./
|
|
|
|
|
|
|
| 13 |
RUN npm ci
|
| 14 |
|
| 15 |
+
# Fail fast if curl-impersonate wasn't downloaded
|
| 16 |
+
RUN test -f bin/curl-impersonate || \
|
| 17 |
+
(echo "FATAL: curl-impersonate not downloaded. Check network." && exit 1)
|
| 18 |
|
| 19 |
+
# 2) Web deps (separate layer for cache efficiency)
|
| 20 |
+
COPY web/package*.json web/
|
| 21 |
+
RUN cd web && npm ci
|
| 22 |
|
| 23 |
+
# 3) Copy source
|
| 24 |
+
COPY . .
|
| 25 |
|
| 26 |
+
# 4) Build frontend (Vite β public/) + backend (tsc β dist/)
|
| 27 |
+
RUN cd web && npm run build && cd .. && npx tsc
|
| 28 |
|
| 29 |
+
# 5) Prune dev deps, re-add tsx (needed at runtime by update-checker fork())
|
| 30 |
+
RUN npm prune --omit=dev && npm install --no-save tsx
|
| 31 |
|
| 32 |
+
VOLUME /app/data
|
| 33 |
+
EXPOSE 8080
|
| 34 |
CMD ["node", "dist/index.js"]
|
docker-compose.yml
CHANGED
|
@@ -1,21 +1,13 @@
|
|
| 1 |
services:
|
| 2 |
codex-proxy:
|
| 3 |
-
build:
|
| 4 |
-
context: .
|
| 5 |
-
# Use host network during build so npm/curl can reach proxy at 127.0.0.1
|
| 6 |
-
network: host
|
| 7 |
ports:
|
| 8 |
- "${PORT:-8080}:8080"
|
| 9 |
volumes:
|
| 10 |
- ./data:/app/data
|
| 11 |
- ./config:/app/config
|
| 12 |
restart: unless-stopped
|
|
|
|
|
|
|
| 13 |
environment:
|
| 14 |
- NODE_ENV=production
|
| 15 |
-
# Runtime proxy for upstream requests (chatgpt.com)
|
| 16 |
-
- HTTP_PROXY=${CONTAINER_PROXY:-}
|
| 17 |
-
- HTTPS_PROXY=${CONTAINER_PROXY:-}
|
| 18 |
-
- NO_PROXY=localhost,127.0.0.1
|
| 19 |
-
extra_hosts:
|
| 20 |
-
# Allow container to reach host network services (proxy, etc.)
|
| 21 |
-
- "host.docker.internal:host-gateway"
|
|
|
|
| 1 |
services:
|
| 2 |
codex-proxy:
|
| 3 |
+
build: .
|
|
|
|
|
|
|
|
|
|
| 4 |
ports:
|
| 5 |
- "${PORT:-8080}:8080"
|
| 6 |
volumes:
|
| 7 |
- ./data:/app/data
|
| 8 |
- ./config:/app/config
|
| 9 |
restart: unless-stopped
|
| 10 |
+
env_file:
|
| 11 |
+
- .env
|
| 12 |
environment:
|
| 13 |
- NODE_ENV=production
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|