From 517b9646bf74b15243f46f145eed83fd63670860 Mon Sep 17 00:00:00 2001 From: weichen Date: Tue, 22 Sep 2026 12:26:05 +0800 Subject: [PATCH] fix(build): make Go GOPROXY a compose build arg for restricted networks Default GOPROXY stays proxy.golang.org to preserve upstream behavior; hosts that cannot reach it pass GO_PROXY (e.g. goproxy.cn) via the env file. Wires app+events build args across dev/test/main compose. Co-authored-by: Cursor --- deploy/app/Dockerfile | 6 ++++++ docker-compose.dev.yml | 4 ++++ docker-compose.main.yml | 4 ++++ docker-compose.test.yml | 4 ++++ 4 files changed, 18 insertions(+) diff --git a/deploy/app/Dockerfile b/deploy/app/Dockerfile index 557e75a7..4aac760a 100644 --- a/deploy/app/Dockerfile +++ b/deploy/app/Dockerfile @@ -11,6 +11,12 @@ RUN npm run build FROM golang:1.23-bookworm AS go-builder +# GOPROXY defaults to the official proxy to preserve upstream build behavior. +# Hosts behind networks that cannot reach proxy.golang.org can pass a +# reachable mirror, e.g. --build-arg GOPROXY=https://goproxy.cn,direct +# (compose wires it from GO_PROXY in the environment env-file). +ARG GOPROXY=https://proxy.golang.org,direct +ENV GOPROXY=${GOPROXY} ENV GOTOOLCHAIN=auto WORKDIR /src diff --git a/docker-compose.dev.yml b/docker-compose.dev.yml index b89d5e98..2fd77ce2 100644 --- a/docker-compose.dev.yml +++ b/docker-compose.dev.yml @@ -71,6 +71,8 @@ services: build: context: . dockerfile: deploy/app/Dockerfile + args: + GOPROXY: ${GO_PROXY:-https://proxy.golang.org,direct} container_name: shuimu-agent-app-dev depends_on: system-db: @@ -152,6 +154,8 @@ services: build: context: . dockerfile: deploy/app/Dockerfile + args: + GOPROXY: ${GO_PROXY:-https://proxy.golang.org,direct} container_name: shuimu-agent-events-dev entrypoint: ["/app/events"] command: ["-env", "/dev/null"] diff --git a/docker-compose.main.yml b/docker-compose.main.yml index 6ca74df3..0c4d2877 100644 --- a/docker-compose.main.yml +++ b/docker-compose.main.yml @@ -68,6 +68,8 @@ services: build: context: . dockerfile: deploy/app/Dockerfile + args: + GOPROXY: ${GO_PROXY:-https://proxy.golang.org,direct} container_name: shuimu-agent-app-main depends_on: system-db: @@ -152,6 +154,8 @@ services: build: context: . dockerfile: deploy/app/Dockerfile + args: + GOPROXY: ${GO_PROXY:-https://proxy.golang.org,direct} container_name: shuimu-agent-events-main entrypoint: ["/app/events"] command: ["-env", "/dev/null"] diff --git a/docker-compose.test.yml b/docker-compose.test.yml index 2ed26c65..111b527c 100644 --- a/docker-compose.test.yml +++ b/docker-compose.test.yml @@ -68,6 +68,8 @@ services: build: context: . dockerfile: deploy/app/Dockerfile + args: + GOPROXY: ${GO_PROXY:-https://proxy.golang.org,direct} container_name: shuimu-agent-app-test depends_on: system-db: @@ -149,6 +151,8 @@ services: build: context: . dockerfile: deploy/app/Dockerfile + args: + GOPROXY: ${GO_PROXY:-https://proxy.golang.org,direct} container_name: shuimu-agent-events-test entrypoint: ["/app/events"] command: ["-env", "/dev/null"]