Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Portal
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Container Registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Fachschaft
Portal
Commits
69c3d45e
Verified
Commit
69c3d45e
authored
5 months ago
by
Sören Ducati
Browse files
Options
Downloads
Patches
Plain Diff
incorporated feedback from
@moser
parent
efd8a26f
No related branches found
Branches containing commit
No related tags found
1 merge request
!26
Drop root privileges in container
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Dockerfile
+7
-4
7 additions, 4 deletions
Dockerfile
with
7 additions
and
4 deletions
Dockerfile
+
7
−
4
View file @
69c3d45e
...
...
@@ -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
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment