Skip to content

Commit

Permalink
Make backend image rootless
Browse files Browse the repository at this point in the history
  • Loading branch information
thomashbrnrd committed Aug 30, 2023
1 parent 18d91b3 commit 59af920
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
13 changes: 13 additions & 0 deletions backend/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,19 @@
FROM python:3.9-slim-buster as base

WORKDIR /app

# Create a non-privileged user that the app will run under.
# See https://docs.docker.com/develop/develop-images/dockerfile_best-practices/#user
ARG UID=10001
RUN adduser \
--disabled-password \
--gecos "" \
--home "/nonexistent" \
--shell "/sbin/nologin" \
--no-create-home \
--uid "${UID}" \
appuser

# certificates config
ARG CACERT_LOCATION
COPY ./cert/. /etc/ssl/certs/
Expand Down
1 change: 1 addition & 0 deletions docker-compose-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ services:
context: ./backend
target: ${BUILD_TARGET:-dev}
container_name: basegun-backend
user: appuser
environment:
- PATH_LOGS=/app/logs
- OS_USERNAME
Expand Down

0 comments on commit 59af920

Please sign in to comment.