Spaces:
Paused
Paused
icebear0828 Claude Opus 4.6 commited on
Commit Β·
814607e
1
Parent(s): b675b05
fix: use BUILD_PROXY arg to avoid BuildKit proxy conflict
Browse filesBuildKit intercepts HTTP_PROXY build args for image pulls, causing
host.docker.internal resolution failures. Use custom BUILD_PROXY arg
instead β Docker daemon's own proxy handles image pulls.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- .env.example +6 -7
- Dockerfile +9 -0
- docker-compose.yml +3 -6
.env.example
CHANGED
|
@@ -11,11 +11,10 @@ CODEX_ARCH=arm64 # arm64/x64
|
|
| 11 |
# ββ Port ββ
|
| 12 |
PORT=8080
|
| 13 |
|
| 14 |
-
# ββ Docker proxy
|
| 15 |
-
# Build-time:
|
| 16 |
-
#
|
| 17 |
-
#
|
| 18 |
|
| 19 |
-
# Runtime:
|
| 20 |
-
#
|
| 21 |
-
# CONTAINER_PROXY=http://host.docker.internal:7897
|
|
|
|
| 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
|
|
|
Dockerfile
CHANGED
|
@@ -7,6 +7,12 @@ RUN apt-get update && \
|
|
| 7 |
|
| 8 |
WORKDIR /app
|
| 9 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
# Install backend dependencies (postinstall downloads curl-impersonate for Linux)
|
| 11 |
COPY package*.json ./
|
| 12 |
RUN npm ci
|
|
@@ -23,6 +29,9 @@ RUN npx tsc
|
|
| 23 |
# Prune dev dependencies
|
| 24 |
RUN npm prune --omit=dev
|
| 25 |
|
|
|
|
|
|
|
|
|
|
| 26 |
# Persistent data mount point
|
| 27 |
VOLUME /app/data
|
| 28 |
|
|
|
|
| 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 |
# 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 |
|
docker-compose.yml
CHANGED
|
@@ -2,12 +2,10 @@ 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 |
-
|
| 9 |
-
|
| 10 |
-
-
|
| 11 |
ports:
|
| 12 |
- "${PORT:-8080}:8080"
|
| 13 |
volumes:
|
|
@@ -17,7 +15,6 @@ services:
|
|
| 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
|
|
|
|
| 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:
|
|
|
|
| 15 |
environment:
|
| 16 |
- NODE_ENV=production
|
| 17 |
# Runtime proxy for upstream requests (chatgpt.com)
|
|
|
|
| 18 |
- HTTP_PROXY=${CONTAINER_PROXY:-}
|
| 19 |
- HTTPS_PROXY=${CONTAINER_PROXY:-}
|
| 20 |
- NO_PROXY=localhost,127.0.0.1
|