Skip to content

Commit

Permalink
Switch to a non-root user in docker (#247)
Browse files Browse the repository at this point in the history
  • Loading branch information
KonstantAnxiety authored Jan 23, 2024
1 parent 58a7eaf commit 6c0706a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
8 changes: 8 additions & 0 deletions app/dl_control_api/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,14 @@ WORKDIR /src/metapkg
RUN poetry export --only app_dl_os_control_api --without-hashes --format=requirements.txt > requirements.txt
RUN pip install -r requirements.txt

# Setting up the runtime user
ARG USER=app
ARG GID=1000
ARG UID=1000
RUN groupadd -r -g ${GID} ${USER} && \
useradd -mr -g ${USER} -u ${UID} -s /bin/bash ${USER}
USER ${USER}

EXPOSE 8080

ENTRYPOINT ["/etc/service/dl_api/run"]
8 changes: 8 additions & 0 deletions app/dl_data_api/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,14 @@ WORKDIR /src/metapkg
RUN poetry export --only app_dl_os_data_api --without-hashes --format=requirements.txt > requirements.txt
RUN pip install -r requirements.txt

# Setting up the runtime user
ARG USER=app
ARG GID=1000
ARG UID=1000
RUN groupadd -r -g ${GID} ${USER} && \
useradd -mr -g ${USER} -u ${UID} -s /bin/bash ${USER}
USER ${USER}

EXPOSE 8080

ENTRYPOINT ["/etc/service/dl_api/run"]

0 comments on commit 6c0706a

Please sign in to comment.