-
Notifications
You must be signed in to change notification settings - Fork 18.3k
Closed
Labels
FrozenDueToAgeGoCommandcmd/gocmd/goNeedsFixThe path to resolution is known, but the work has not been done.The path to resolution is known, but the work has not been done.
Milestone
Description
I build my projects with a basic Dockerfile based on golang:alpine
, the project dependencies are in the /vendor directory, so no additional download is required. (e.g. when the build containers are not connected to the internet)
it also uses the flag:
ENV GOFLAGS -mod=vendor
this worked well before 1.18 (with an older version of golang:alpine):
docker build -t myservice .
Sending build context to Docker daemon 108.2MB
Step 1/16 : FROM golang:alpine as builder
---> 193418aa4321
Step 2/16 : RUN mkdir -p /go/src/the/path/myservice
---> Running in 05a96bf34d09
Removing intermediate container 05a96bf34d09
---> 9521959475d3
Step 3/16 : ADD . /go/src/the/path/myservice/
---> 9422e1bcf73e
Step 4/16 : WORKDIR /go/src/the/path/myservice
---> Running in 5e6ba7885d39
Removing intermediate container 5e6ba7885d39
---> 5c017e30587c
Step 5/16 : ENV GOFLAGS -mod=vendor
---> Running in 49c7bafa12c1
Removing intermediate container 49c7bafa12c1
---> 709db29e8cbf
Step 6/16 : RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o myservice .
---> Running in 95fa26e0baba
Removing intermediate container 95fa26e0baba
---> 3dd723395943
Step 7/16 : FROM alpine
---> e50c909a8df2
Step 8/16 : RUN adduser -S -D -H -h /app appuser
---> Using cache
---> 4e72bf554722
Step 9/16 : RUN mkdir -p /app/config
---> Using cache
---> 94fe18c448fd
Step 10/16 : COPY --from=builder /go/src/the/path/myservice/config.yml /app/config
---> 8d9678bac41f
Step 11/16 : COPY --from=builder /go/src/the/path/myservice/myservice /app/
---> d2634c5cd75c
Step 12/16 : RUN chown appuser /app -R
---> Running in ad86f7ce8c8f
Removing intermediate container ad86f7ce8c8f
---> 003a2a823362
Step 13/16 : USER appuser
---> Running in e499ca060a6f
Removing intermediate container e499ca060a6f
---> 3bcc8ec26edf
Step 14/16 : WORKDIR /app
---> Running in ce3e9b1c4bd8
Removing intermediate container ce3e9b1c4bd8
---> d298a549af1a
Step 15/16 : LABEL some=label
---> Running in 63233dfdd0c2
Removing intermediate container 63233dfdd0c2
---> b1a2212ac232
Step 16/16 : ENTRYPOINT ["./myservice"]
---> Running in e9f0389e5bb3
Removing intermediate container e9f0389e5bb3
---> ef3ec44b2fce
Successfully built ef3ec44b2fce
Successfully tagged myservice:latest
after i did docker pull golang:alpine
it now fails because it tries to download the dependencies with git (which is also not installed in the alpine image):
Sending build context to Docker daemon 108.2MB
Step 1/16 : FROM golang:alpine as builder
---> f25c27b88763
Step 2/16 : RUN mkdir -p /go/src/the/path/myservice
---> Using cache
---> 9f221460c293
Step 3/16 : ADD . /go/src/the/path/myservice/
---> 91908022017e
Step 4/16 : WORKDIR /go/src/the/path/myservice
---> Running in 4bfd07048c2c
Removing intermediate container 4bfd07048c2c
---> 048d0c9d4bf8
Step 5/16 : ENV GOFLAGS -mod=vendor
---> Running in 1b16198b759d
Removing intermediate container 1b16198b759d
---> b240205af17d
Step 6/16 : RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o myservice .
---> Running in 540afc754acb
go: missing Git command. See https://golang.org/s/gogetcmd
error obtaining VCS status: exec: "git": executable file not found in $PATH
Use -buildvcs=false to disable VCS stamping.
The command '/bin/sh -c CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o myservice .' returned a non-zero code: 1
doing a go mod vendor
does not change anything, any advice?
ocket8888 and RyanMannix
Metadata
Metadata
Assignees
Labels
FrozenDueToAgeGoCommandcmd/gocmd/goNeedsFixThe path to resolution is known, but the work has not been done.The path to resolution is known, but the work has not been done.