fix: add all directories as safe git directories inside the Docker image (#4034)
Some checks failed
Release a tag / release (push) Has been cancelled
Release a tag / docker-release (map[Dockerfile:build/Dockerfile]) (push) Has been cancelled
Release a tag / docker-release (map[Dockerfile:build/alpine.Dockerfile]) (push) Has been cancelled

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

View File

@ -13,6 +13,8 @@ RUN CGO_ENABLED=0 go build -trimpath -ldflags "-s -w -X main.version=$VERSION -X
FROM golang:1.21
# related to https://github.com/golangci/golangci-lint/issues/3107
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
COPY --from=builder /golangci/golangci-lint /usr/bin/
CMD ["golangci-lint"]

View File

@ -22,6 +22,8 @@ ENV GOROOT /usr/local/go
# git and mercurial are needed most times for go get`, etc.
# See https://github.com/docker-library/golang/issues/80
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
COPY --from=builder /golangci/golangci-lint /usr/bin/
CMD ["golangci-lint"]