Skip to content
Snippets Groups Projects
Commit 50c97c2a authored by Jakob Moser's avatar Jakob Moser
Browse files

Merge branch 'drop-root-permissions' into 'master'

Drop root privileges in container

See merge request !26
parents a7c2343d 69c3d45e
No related branches found
No related tags found
1 merge request!26Drop root privileges in container
Pipeline #6728 passed with warnings
......@@ -4,7 +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 ${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 .
......@@ -13,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 . .
COPY --chown=${USERNAME}:${USERNAME} . .
FROM base AS dev
ENV SERVER_TYPE=flask
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment