From 69c3d45e932574423f0fd3cc0429c18ece2d5ef7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=B6ren=20Ducati?= <ducati@cl.uni-heidelberg.de>
Date: Thu, 26 Sep 2024 18:51:12 +0000
Subject: [PATCH] incorporated feedback from @moser

---
 Dockerfile | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/Dockerfile b/Dockerfile
index f025150..9ef266a 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -4,10 +4,13 @@ FROM python:3.12 AS base
 WORKDIR /app
 EXPOSE 5000
 
+ARG USERNAME="portaluser"
+
 # First, copy and install only the requirements...
-RUN useradd -ms /bin/bash python && chown -R python:python /app
-USER python
-ENV PATH="$PATH:/home/python/.local/bin"
+RUN useradd -ms /bin/bash ${USERNAME} && chown -R ${USERNAME}:${USERNAME} /app
+USER ${USERNAME}
+# The modified PATH is needed so that the pipenv executaable is found.
+ENV PATH="$PATH:/home/${USERNAME}/.local/bin"
 RUN pip install --upgrade pip setuptools
 RUN pip install pipenv
 COPY Pipfile.lock .
@@ -16,7 +19,7 @@ RUN pip uninstall --yes pipenv
 RUN pip install -r requirements.txt
 # ... then the rest of the application. This allows the installation stage to be cached most of the time
 # (so we don't have reinstall of all dependencies every time the container is rebuilt)
-COPY --chown=python:python . .
+COPY --chown=${USERNAME}:${USERNAME} . .
 
 FROM base AS dev
 ENV SERVER_TYPE=flask
-- 
GitLab