From 2712e2ef176b560ba4a9c784cb75f1ff813bbaf1 Mon Sep 17 00:00:00 2001 From: Nicholas Wiersma Date: Mon, 7 Oct 2024 21:22:53 +0200 Subject: [PATCH] fix: go in docker failing (#1989) Co-authored-by: Matt --- cmd/proxy/Dockerfile | 10 ++++++---- pkg/module/prepare_env.go | 2 ++ 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/cmd/proxy/Dockerfile b/cmd/proxy/Dockerfile index 2c52b0683..7ca589bbe 100644 --- a/cmd/proxy/Dockerfile +++ b/cmd/proxy/Dockerfile @@ -29,17 +29,19 @@ RUN DATE="$(date -u +%Y-%m-%d-%H:%M:%S-%Z)" && \ FROM alpine:${ALPINE_VERSION} -ENV GO111MODULE=on +ENV GOROOT="/usr/local/go" \ + PATH=/go/bin:/usr/local/go/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin \ + GO111MODULE=on COPY --from=builder /bin/athens-proxy /bin/athens-proxy COPY --from=builder /go/src/github.com/gomods/athens/config.dev.toml /config/config.toml -COPY --from=builder /usr/local/go/bin/go /bin/go +COPY --from=builder /usr/local/go/bin/go /usr/local/go/bin/go +COPY --from=builder /usr/local/go/go.env /usr/local/go/go.env RUN chmod 644 /config/config.toml # Add tini, see https://github.com/gomods/athens/issues/1155 for details. -RUN apk add --update git git-lfs mercurial openssh-client subversion procps fossil tini && \ - mkdir -p /usr/local/go +RUN apk add --update git git-lfs mercurial openssh-client subversion procps fossil tini ARG USER=athens RUN adduser -D -h /home/$USER $USER diff --git a/pkg/module/prepare_env.go b/pkg/module/prepare_env.go index f12b83340..895d0f61f 100644 --- a/pkg/module/prepare_env.go +++ b/pkg/module/prepare_env.go @@ -29,6 +29,8 @@ func prepareEnv(gopath string, envVars []string) []string { "HTTP_PROXY", "HTTPS_PROXY", "NO_PROXY", + // GOROOT needs to be propagated if it exists. + "GOROOT", // Need to also check the lower case version of just these three env variables. "http_proxy", "https_proxy",