Skip to content

Commit 411e0bb

Browse files
authored
fix: add all directories as safe git directories inside the Docker image (#4034)
1 parent ac0627d commit 411e0bb

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

build/Dockerfile

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

build/alpine.Dockerfile

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

0 commit comments

Comments
 (0)