Skip to content

Commit

Permalink
updated Django to run as non-root
Browse files Browse the repository at this point in the history
  • Loading branch information
Neffi42 committed Aug 5, 2024
1 parent 5fda119 commit d48d4d9
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions django/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ WORKDIR /app
EXPOSE 8000
VOLUME [ "/app" ]

RUN groupadd -r appUser && useradd -r -g appUser appUser
RUN chown appUser:appUser /app
RUN mkdir /static
RUN chown appUser:appUser /static

ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED=1

Expand All @@ -16,4 +21,6 @@ RUN pip install --no-cache-dir -r requirements.txt
COPY conf/entrypoint.sh /entrypoint.sh
RUN chmod a+x /entrypoint.sh

USER appUser

CMD [ "/entrypoint.sh" ]

0 comments on commit d48d4d9

Please sign in to comment.