From e05d9e40905390e08310d703eb2c6d76edb994fe Mon Sep 17 00:00:00 2001 From: alvicsam Date: Wed, 23 Nov 2022 17:55:56 +0100 Subject: [PATCH] add nonroot user --- dockerfiles/mdbook-utils/Dockerfile | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/dockerfiles/mdbook-utils/Dockerfile b/dockerfiles/mdbook-utils/Dockerfile index 136dd87c..fb93822c 100644 --- a/dockerfiles/mdbook-utils/Dockerfile +++ b/dockerfiles/mdbook-utils/Dockerfile @@ -29,3 +29,12 @@ RUN apt-get update -y && \ ./rustup-init -y --no-modify-path --profile minimal --default-toolchain stable && \ rm rustup-init && \ cargo install mdbook mdbook-mermaid mdbook-linkcheck mdbook-graphviz mdbook-last-changed + +RUN set -x \ + && groupadd -g 1000 nonroot \ + && useradd -u 1000 -g 1000 -s /bin/bash -m nonroot \ + && git config --global --add safe.directory '*' \ + && cp /root/.gitconfig /home/nonroot/.gitconfig \ + && chown nonroot:nonroot /home/nonroot/.gitconfig + +USER nonroot:nonroot