diff --git a/docker-compose.yml b/docker-compose.yml index b08cfc0f..e35baf09 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,8 +1,13 @@ +x-go-build-args: &go-build-args + GOPROXY: "${GOPROXY:-https://goproxy.cn|https://proxy.golang.org|direct}" + GOSUMDB: "${GOSUMDB:-sum.golang.org}" + services: gateway-service: build: context: . dockerfile: services/gateway-service/Dockerfile + args: *go-build-args container_name: gateway-service environment: TZ: UTC @@ -26,6 +31,7 @@ services: build: context: . dockerfile: services/room-service/Dockerfile + args: *go-build-args container_name: room-service environment: TZ: UTC @@ -49,6 +55,7 @@ services: build: context: . dockerfile: services/wallet-service/Dockerfile + args: *go-build-args container_name: wallet-service environment: TZ: UTC @@ -72,6 +79,7 @@ services: build: context: . dockerfile: services/user-service/Dockerfile + args: *go-build-args container_name: user-service environment: TZ: UTC @@ -91,6 +99,7 @@ services: build: context: . dockerfile: services/activity-service/Dockerfile + args: *go-build-args container_name: activity-service environment: TZ: UTC @@ -112,6 +121,7 @@ services: build: context: . dockerfile: services/cron-service/Dockerfile + args: *go-build-args container_name: cron-service environment: TZ: UTC diff --git a/services/activity-service/Dockerfile b/services/activity-service/Dockerfile index f35fe34c..c10ab51e 100644 --- a/services/activity-service/Dockerfile +++ b/services/activity-service/Dockerfile @@ -2,6 +2,11 @@ FROM golang:1.26.3-alpine AS builder WORKDIR /src +# Module proxy is a build-time contract so Docker builds can recover from transient proxy EOFs. +ARG GOPROXY=https://goproxy.cn|https://proxy.golang.org|direct +ARG GOSUMDB=sum.golang.org +ENV GOPROXY=${GOPROXY} GOSUMDB=${GOSUMDB} + COPY go.mod go.sum ./ COPY api/go.mod api/go.sum ./api/ RUN GOWORK=off go mod download diff --git a/services/cron-service/Dockerfile b/services/cron-service/Dockerfile index f3488f50..60cac8e8 100644 --- a/services/cron-service/Dockerfile +++ b/services/cron-service/Dockerfile @@ -2,6 +2,11 @@ FROM golang:1.26.3-alpine AS builder WORKDIR /src +# Module proxy is a build-time contract so Docker builds can recover from transient proxy EOFs. +ARG GOPROXY=https://goproxy.cn|https://proxy.golang.org|direct +ARG GOSUMDB=sum.golang.org +ENV GOPROXY=${GOPROXY} GOSUMDB=${GOSUMDB} + COPY go.mod go.sum ./ COPY api/go.mod api/go.sum ./api/ RUN GOWORK=off go mod download diff --git a/services/gateway-service/Dockerfile b/services/gateway-service/Dockerfile index 601c8bf3..e27123aa 100644 --- a/services/gateway-service/Dockerfile +++ b/services/gateway-service/Dockerfile @@ -2,6 +2,11 @@ FROM golang:1.26.3-alpine AS builder WORKDIR /src +# Module proxy is a build-time contract so Docker builds can recover from transient proxy EOFs. +ARG GOPROXY=https://goproxy.cn|https://proxy.golang.org|direct +ARG GOSUMDB=sum.golang.org +ENV GOPROXY=${GOPROXY} GOSUMDB=${GOSUMDB} + COPY go.mod go.sum ./ COPY api/go.mod api/go.sum ./api/ RUN GOWORK=off go mod download diff --git a/services/room-service/Dockerfile b/services/room-service/Dockerfile index 7f848466..036dbbdd 100644 --- a/services/room-service/Dockerfile +++ b/services/room-service/Dockerfile @@ -2,6 +2,11 @@ FROM golang:1.26.3-alpine AS builder WORKDIR /src +# Module proxy is a build-time contract so Docker builds can recover from transient proxy EOFs. +ARG GOPROXY=https://goproxy.cn|https://proxy.golang.org|direct +ARG GOSUMDB=sum.golang.org +ENV GOPROXY=${GOPROXY} GOSUMDB=${GOSUMDB} + COPY go.mod go.sum ./ COPY api/go.mod api/go.sum ./api/ RUN GOWORK=off go mod download diff --git a/services/user-service/Dockerfile b/services/user-service/Dockerfile index a660eff5..c5f43451 100644 --- a/services/user-service/Dockerfile +++ b/services/user-service/Dockerfile @@ -2,6 +2,11 @@ FROM golang:1.26.3-alpine AS builder WORKDIR /src +# Module proxy is a build-time contract so Docker builds can recover from transient proxy EOFs. +ARG GOPROXY=https://goproxy.cn|https://proxy.golang.org|direct +ARG GOSUMDB=sum.golang.org +ENV GOPROXY=${GOPROXY} GOSUMDB=${GOSUMDB} + COPY go.mod go.sum ./ COPY api/go.mod api/go.sum ./api/ RUN GOWORK=off go mod download diff --git a/services/wallet-service/Dockerfile b/services/wallet-service/Dockerfile index 4f6fe148..64a8d515 100644 --- a/services/wallet-service/Dockerfile +++ b/services/wallet-service/Dockerfile @@ -2,6 +2,11 @@ FROM golang:1.26.3-alpine AS builder WORKDIR /src +# Module proxy is a build-time contract so Docker builds can recover from transient proxy EOFs. +ARG GOPROXY=https://goproxy.cn|https://proxy.golang.org|direct +ARG GOSUMDB=sum.golang.org +ENV GOPROXY=${GOPROXY} GOSUMDB=${GOSUMDB} + COPY go.mod go.sum ./ COPY api/go.mod api/go.sum ./api/ RUN GOWORK=off go mod download