From da748c2cae98b67979c5151a3d1e8aedf03255cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Le=20Pr=C3=A9vost-Corvellec=20Arnault?= Date: Wed, 8 Apr 2026 22:12:44 +0200 Subject: [PATCH] Refactor Dockerfile to improve user configuration and permissions - Removed the creation of a home directory for the nginx user, simplifying the setup for a stateless image. - Updated git configuration to use a temporary home directory, enhancing compatibility with non-root user practices. - Adjusted ownership of the temporary git configuration file to align with UID and GID parameters. --- server/Dockerfile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/server/Dockerfile b/server/Dockerfile index 01bb91b..da46bc6 100644 --- a/server/Dockerfile +++ b/server/Dockerfile @@ -24,13 +24,13 @@ RUN find . -mindepth 1 -delete \ COPY nginx/default.conf /etc/nginx/conf.d/default.conf COPY refresh.sh /refresh.sh +# Pas de « su 101 » : git config en root puis chown. HOME=/tmp : pas de /home artificiel dans une image stateless. RUN chmod +x /refresh.sh \ && chown -R "${UID}:${GID}" /usr/share/nginx/html /refresh.sh \ - && mkdir -p /home/nginx \ - && chown "${UID}:${GID}" /home/nginx \ - && su "${UID}" -s /bin/sh -c 'HOME=/home/nginx git config --global --add safe.directory /usr/share/nginx/html' + && HOME=/tmp git config --global --add safe.directory /usr/share/nginx/html \ + && chown "${UID}:${GID}" /tmp/.gitconfig -ENV HOME=/home/nginx +ENV HOME=/tmp USER ${UID}