Browse Source

build: download go module before compile

v1.x.x
dnomd343 2 years ago
parent
commit
6375bd49ad
  1. 1
      Dockerfile

1
Dockerfile

@ -38,6 +38,7 @@ RUN upx -9 /tmp/sagray
FROM golang:1.18-alpine3.16 AS xproxy FROM golang:1.18-alpine3.16 AS xproxy
COPY . /XProxy COPY . /XProxy
WORKDIR /XProxy WORKDIR /XProxy
RUN go mod download -x
RUN env CGO_ENABLED=0 go build -v -o xproxy -trimpath \ RUN env CGO_ENABLED=0 go build -v -o xproxy -trimpath \
-ldflags "-X 'main.goVersion=$(go version)' -s -w" ./cmd/ && mv ./xproxy /tmp/ -ldflags "-X 'main.goVersion=$(go version)' -s -w" ./cmd/ && mv ./xproxy /tmp/
COPY --from=upx /upx/ /usr/ COPY --from=upx /upx/ /usr/

Loading…
Cancel
Save