From 70f31c01aba36b1b0dc722a3cd857defda50463f Mon Sep 17 00:00:00 2001 From: Omar Siam Date: Tue, 29 Oct 2024 14:14:01 +0100 Subject: [PATCH] Add a fix to always dirty on Windows docker builds --- Dockerfile | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index d2f82b7..963626e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,11 +8,15 @@ WORKDIR /app/ COPY . /app # Create the user and install all dependencies +# Declare the /app directory as a safe for any git operations, like reading the revision and tag +# Reset the git repository to the last commit as otherwise +# the image will report as dirty if build on windows due to the line endings. RUN groupadd --gid $USER_GID $USERNAME \ && useradd --uid $USER_UID --gid $USER_GID -m $USERNAME \ && apt update && apt -y full-upgrade && apt install -y git && pip3 install poetry && apt clean \ && poetry config virtualenvs.create false && poetry install --no-dev && poetry cache clear --all . \ - && git config --system --add safe.directory /app + && git config --system --add safe.directory /app \ + && cd /app && git reset --hard USER app