icebear0828 Claude Opus 4.6 commited on
Commit
b675b05
Β·
1 Parent(s): 3d01305

fix: Docker build supports proxy via .env configuration

Browse files

- docker-compose.yml reads HTTP_PROXY and CONTAINER_PROXY from .env
- Build args pass proxy to npm/GitHub downloads inside container
- Runtime proxy uses host.docker.internal to reach host proxy
- .env.example documents all proxy settings
- No per-machine Docker daemon config needed

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

Files changed (4) hide show
  1. .dockerignore +1 -0
  2. .env.example +17 -0
  3. Dockerfile +2 -2
  4. docker-compose.yml +17 -2
.dockerignore CHANGED
@@ -7,3 +7,4 @@ tmp/
7
  .git/
8
  docs/
9
  stitch-*/
 
 
7
  .git/
8
  docs/
9
  stitch-*/
10
+ .env
.env.example CHANGED
@@ -1,4 +1,21 @@
 
 
 
 
1
  CODEX_JWT_TOKEN= # Optional: paste ChatGPT JWT directly (skip OAuth)
 
 
2
  CODEX_PLATFORM=darwin # darwin/win32/linux
3
  CODEX_ARCH=arm64 # arm64/x64
 
 
4
  PORT=8080
 
 
 
 
 
 
 
 
 
 
1
+ # Codex Proxy environment configuration
2
+ # Copy to .env and adjust: cp .env.example .env
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 proxy configuration ──
15
+ # Build-time: used during `docker compose build` for npm/GitHub access
16
+ # HTTP_PROXY=http://host.docker.internal:7897
17
+ # HTTPS_PROXY=http://host.docker.internal:7897
18
+
19
+ # Runtime: container uses this proxy to reach chatgpt.com
20
+ # Use host.docker.internal to reach a proxy on the Docker host
21
+ # CONTAINER_PROXY=http://host.docker.internal:7897
Dockerfile CHANGED
@@ -1,8 +1,8 @@
1
  FROM node:20-slim
2
 
3
- # Install unzip (full-update pipeline) and ca-certificates
4
  RUN apt-get update && \
5
- apt-get install -y --no-install-recommends unzip ca-certificates && \
6
  rm -rf /var/lib/apt/lists/*
7
 
8
  WORKDIR /app
 
1
  FROM node:20-slim
2
 
3
+ # Install unzip (full-update pipeline), curl, and ca-certificates
4
  RUN apt-get update && \
5
+ apt-get install -y --no-install-recommends unzip curl ca-certificates && \
6
  rm -rf /var/lib/apt/lists/*
7
 
8
  WORKDIR /app
docker-compose.yml CHANGED
@@ -1,11 +1,26 @@
1
  services:
2
  codex-proxy:
3
- build: .
 
 
 
 
 
 
 
4
  ports:
5
- - "8080:8080"
6
  volumes:
7
  - ./data:/app/data
8
  - ./config:/app/config
9
  restart: unless-stopped
10
  environment:
11
  - NODE_ENV=production
 
 
 
 
 
 
 
 
 
1
  services:
2
  codex-proxy:
3
+ build:
4
+ context: .
5
+ # Pass host proxy to build stage (npm install, curl downloads)
6
+ # Set HTTP_PROXY in .env or shell environment
7
+ args:
8
+ - HTTP_PROXY=${HTTP_PROXY:-}
9
+ - HTTPS_PROXY=${HTTPS_PROXY:-}
10
+ - NO_PROXY=${NO_PROXY:-localhost,127.0.0.1}
11
  ports:
12
+ - "${PORT:-8080}:8080"
13
  volumes:
14
  - ./data:/app/data
15
  - ./config:/app/config
16
  restart: unless-stopped
17
  environment:
18
  - NODE_ENV=production
19
+ # Runtime proxy for upstream requests (chatgpt.com)
20
+ # Use host.docker.internal to reach host's proxy from container
21
+ - HTTP_PROXY=${CONTAINER_PROXY:-}
22
+ - HTTPS_PROXY=${CONTAINER_PROXY:-}
23
+ - NO_PROXY=localhost,127.0.0.1
24
+ extra_hosts:
25
+ # Allow container to reach host network services (proxy, etc.)
26
+ - "host.docker.internal:host-gateway"