From d77fbd675b2b4adf3bbdec2a91cd400ebc3fb4d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A7=9A=E7=AB=A0=E6=B5=A9?= Date: Fri, 11 Sep 2026 17:27:20 +0800 Subject: [PATCH] fix(deploy): honor configured Go module proxy --- Dockerfile | 2 ++ scripts/containerized_deployment_test.go | 16 ++++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/Dockerfile b/Dockerfile index 392d46e..90c5004 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,6 +2,8 @@ FROM golang:1.26.5-bookworm AS build WORKDIR /src COPY go.mod go.sum ./ +ARG GOPROXY=https://proxy.golang.org,direct +ENV GOPROXY=${GOPROXY} RUN go mod download COPY . ./ diff --git a/scripts/containerized_deployment_test.go b/scripts/containerized_deployment_test.go index 0ba4696..1416fb4 100644 --- a/scripts/containerized_deployment_test.go +++ b/scripts/containerized_deployment_test.go @@ -40,6 +40,22 @@ func TestRootInstallerBuildsImageWithoutOperatorImageArgument(t *testing.T) { } } +func TestDockerfilePropagatesConfiguredGoProxyToModuleDownload(t *testing.T) { + data, err := os.ReadFile("../Dockerfile") + if err != nil { + t.Fatal(err) + } + source := string(data) + for _, required := range []string{"ARG GOPROXY=", "ENV GOPROXY=${GOPROXY}", "RUN go mod download"} { + if !strings.Contains(source, required) { + t.Errorf("Dockerfile missing %q", required) + } + } + if !(strings.Index(source, "ENV GOPROXY=${GOPROXY}") < strings.Index(source, "RUN go mod download")) { + t.Fatal("Dockerfile must set GOPROXY before downloading modules") + } +} + func TestRDSInitializerOnlyInitializesEmptySchemaAndRejectsInconsistentSchema(t *testing.T) { data, err := os.ReadFile("../deploy/dobotai-dingtalk/rds-schema-init.sh") if err != nil {