github.com/vanstinator/golangci-lint@v0.0.0-20240223191551-cc572f00d9d1/build/Dockerfile (about) 1 # stage 1 building the code 2 FROM golang:1.21 as builder 3 4 ARG VERSION 5 ARG SHORT_COMMIT 6 ARG DATE 7 8 COPY / /golangci 9 WORKDIR /golangci 10 RUN APP_VERSION=${VERSION#v} \ 11 CGO_ENABLED=0 \ 12 go build -trimpath -ldflags "-s -w -X main.version=$APP_VERSION -X main.commit=$SHORT_COMMIT -X main.date=$DATE" -o golangci-lint ./cmd/golangci-lint/main.go 13 14 # stage 2 15 FROM golang:1.21 16 # related to https://github.com/vanstinator/golangci-lint/issues/3107 17 ENV GOROOT /usr/local/go 18 # Set all directories as safe 19 RUN git config --global --add safe.directory '*' 20 # don't place it into $GOPATH/bin because Drone mounts $GOPATH as volume 21 COPY --from=builder /golangci/golangci-lint /usr/bin/ 22 CMD ["golangci-lint"]