Skip to content

Commit

Permalink
Add -buildvcs=false to go build in Dockerfile
Browse files Browse the repository at this point in the history
See docker-library/golang#415

Signed-off-by: AKP <tom@tdpain.net>
  • Loading branch information
codemicro committed Apr 5, 2022
1 parent 8781854 commit 75606ae
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions Dockerfile
@@ -1,9 +1,10 @@
FROM golang:1-alpine as builder
FROM golang:1.18-alpine as builder

RUN mkdir /build
ADD . /build/
WORKDIR /build
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -ldflags '-extldflags "-static" -s -w' -o main github.com/codemicro/walrss/walrss
# Go 1.18 introduced a compile-time dependency for Git unless `-buildvcs=false` is provided
RUN CGO_ENABLED=0 GOOS=linux go build -a -buildvcs=false -installsuffix cgo -ldflags '-extldflags "-static" -s -w' -o main github.com/codemicro/walrss/walrss

FROM alpine
COPY --from=builder /build/main /
Expand Down

0 comments on commit 75606ae

Please sign in to comment.