icebear0828 Claude Opus 4.6 commited on
Commit
8a1166d
Β·
1 Parent(s): 814607e

fix: Docker build uses host network for proxy access

Browse files

Build with network:host so npm/curl inside the build container can
directly use the host's proxy (127.0.0.1). Eliminates the need for
BUILD_PROXY and host.docker.internal resolution during build.

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

Files changed (3) hide show
  1. .env.example +3 -6
  2. Dockerfile +0 -9
  3. docker-compose.yml +2 -4
.env.example CHANGED
@@ -11,10 +11,7 @@ CODEX_ARCH=arm64 # arm64/x64
11
  # ── Port ──
12
  PORT=8080
13
 
14
- # ── Docker proxy ──
15
- # Build-time: proxy for npm install / GitHub downloads inside Docker build.
16
- # host.docker.internal refers to the Docker host machine.
17
- # BUILD_PROXY=http://host.docker.internal:7890
18
-
19
- # Runtime: proxy for the container to reach chatgpt.com.
20
  # CONTAINER_PROXY=http://host.docker.internal:7890
 
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
Dockerfile CHANGED
@@ -7,12 +7,6 @@ RUN apt-get update && \
7
 
8
  WORKDIR /app
9
 
10
- # Optional build-time proxy for npm/GitHub downloads inside RUN commands.
11
- # Uses custom arg name to avoid BuildKit intercepting HTTP_PROXY for image pulls.
12
- # Docker daemon's own proxy handles image pulls separately.
13
- ARG BUILD_PROXY
14
- ENV http_proxy=${BUILD_PROXY} https_proxy=${BUILD_PROXY}
15
-
16
  # Install backend dependencies (postinstall downloads curl-impersonate for Linux)
17
  COPY package*.json ./
18
  RUN npm ci
@@ -29,9 +23,6 @@ RUN npx tsc
29
  # Prune dev dependencies
30
  RUN npm prune --omit=dev
31
 
32
- # Clear build-time proxy from image
33
- ENV http_proxy= https_proxy=
34
-
35
  # Persistent data mount point
36
  VOLUME /app/data
37
 
 
7
 
8
  WORKDIR /app
9
 
 
 
 
 
 
 
10
  # Install backend dependencies (postinstall downloads curl-impersonate for Linux)
11
  COPY package*.json ./
12
  RUN npm ci
 
23
  # Prune dev dependencies
24
  RUN npm prune --omit=dev
25
 
 
 
 
26
  # Persistent data mount point
27
  VOLUME /app/data
28
 
docker-compose.yml CHANGED
@@ -2,10 +2,8 @@ services:
2
  codex-proxy:
3
  build:
4
  context: .
5
- args:
6
- # Proxy for RUN commands (npm install, curl downloads).
7
- # host.docker.internal resolves to the Docker host's IP.
8
- - BUILD_PROXY=${BUILD_PROXY:-}
9
  ports:
10
  - "${PORT:-8080}:8080"
11
  volumes:
 
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: