fix: add all directories as safe git directories inside the Docker image ()

This commit is contained in:
Ludovic Fernandez 2023-08-21 13:04:00 +02:00 committed by GitHub
parent ac0627ddab
commit 411e0bbbd3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 0 deletions

@ -13,6 +13,8 @@ RUN CGO_ENABLED=0 go build -trimpath -ldflags "-s -w -X main.version=$VERSION -X
FROM golang:1.21 FROM golang:1.21
# related to https://github.com/golangci/golangci-lint/issues/3107 # related to https://github.com/golangci/golangci-lint/issues/3107
ENV GOROOT /usr/local/go ENV GOROOT /usr/local/go
# Set all directories as safe
RUN git config --global --add safe.directory '*'
# don't place it into $GOPATH/bin because Drone mounts $GOPATH as volume # don't place it into $GOPATH/bin because Drone mounts $GOPATH as volume
COPY --from=builder /golangci/golangci-lint /usr/bin/ COPY --from=builder /golangci/golangci-lint /usr/bin/
CMD ["golangci-lint"] CMD ["golangci-lint"]

@ -22,6 +22,8 @@ ENV GOROOT /usr/local/go
# git and mercurial are needed most times for go get`, etc. # git and mercurial are needed most times for go get`, etc.
# See https://github.com/docker-library/golang/issues/80 # See https://github.com/docker-library/golang/issues/80
RUN apk --no-cache add gcc musl-dev git mercurial RUN apk --no-cache add gcc musl-dev git mercurial
# Set all directories as safe
RUN git config --global --add safe.directory '*'
# don't place it into $GOPATH/bin because Drone mounts $GOPATH as volume # don't place it into $GOPATH/bin because Drone mounts $GOPATH as volume
COPY --from=builder /golangci/golangci-lint /usr/bin/ COPY --from=builder /golangci/golangci-lint /usr/bin/
CMD ["golangci-lint"] CMD ["golangci-lint"]