From 453d38be989b1be5377a5306a39731bc71af20c4 Mon Sep 17 00:00:00 2001 From: x <> Date: Thu, 2 Jun 2022 08:56:33 +0300 Subject: [PATCH 1/2] fix git unsafe directory fixes https://github.com/zricethezav/gitleaks/issues/846 --- Dockerfile | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/Dockerfile b/Dockerfile index cee623d20..a0d018ac8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,21 +4,13 @@ COPY . . RUN VERSION=$(git describe --tags --abbrev=0) && \ CGO_ENABLED=0 go build -o bin/gitleaks -ldflags "-X="github.com/zricethezav/gitleaks/v8/cmd.Version=${VERSION} -FROM alpine:3.15.4 +FROM alpine:3.16 RUN adduser -D gitleaks && \ apk add --no-cache bash git openssh-client COPY --from=build /go/src/github.com/zricethezav/gitleaks/bin/* /usr/bin/ USER gitleaks -# default to avoid the follow error: -# 11:09PM ERR fatal: unsafe repository ('/path' is owned by someone else) -# 11:09PM ERR To add an exception for this directory, call: -# 11:09PM ERR -# 11:09PM ERR git config --global --add safe.directory /path -# This means that when you run gitleaks from docker you must mount to /path -# in order to avoid this error. - # TODO waiting to push this until I've thought a bit more about it -# RUN git config --global --add safe.directory /path +RUN git config --global --add safe.directory '*' ENTRYPOINT ["gitleaks"] From c366ec76e3b9dd6f3243da1cf6a91912afa0ee85 Mon Sep 17 00:00:00 2001 From: foolioo <28758375+foolioo@users.noreply.github.com> Date: Thu, 2 Jun 2022 15:45:37 +0000 Subject: [PATCH 2/2] Update Dockerfile --- Dockerfile | 1 - 1 file changed, 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index a0d018ac8..ee6f6db83 100644 --- a/Dockerfile +++ b/Dockerfile @@ -10,7 +10,6 @@ RUN adduser -D gitleaks && \ COPY --from=build /go/src/github.com/zricethezav/gitleaks/bin/* /usr/bin/ USER gitleaks -# TODO waiting to push this until I've thought a bit more about it RUN git config --global --add safe.directory '*' ENTRYPOINT ["gitleaks"]