From edb9f05b84400d38eaace5d103dc72c6b6eb1ac0 Mon Sep 17 00:00:00 2001 From: Tim Bannister Date: Thu, 14 Apr 2022 17:10:39 +0100 Subject: [PATCH] Work around git directory ownership change check Add a mitigation for the extra checks that Git added in response to CVE-2022-24765. --- Dockerfile | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 9e9a6d65b0..a45fa4f0ac 100644 --- a/Dockerfile +++ b/Dockerfile @@ -27,16 +27,18 @@ RUN mkdir $HOME/src && \ FROM golang:1.16-alpine RUN apk add --no-cache \ + runuser \ git \ openssh-client \ rsync \ npm && \ npm install -D autoprefixer postcss-cli -RUN mkdir -p /usr/local/src && \ - cd /usr/local/src && \ +RUN mkdir -p /var/hugo && \ addgroup -Sg 1000 hugo && \ - adduser -Sg hugo -u 1000 -h /src hugo + adduser -Sg hugo -u 1000 -h /var/hugo hugo && \ + chown -R hugo: /var/hugo && \ + runuser -u hugo -- git config --global --add safe.directory /src COPY --from=0 /go/bin/hugo /usr/local/bin/hugo