Add application user
This commit is contained in:
@ -1,5 +1,10 @@
|
||||
FROM python:3.11-slim-bookworm
|
||||
|
||||
# uid to run application
|
||||
ARG USER=1000
|
||||
# gid to run application
|
||||
ARG USER_GROUP=1000
|
||||
|
||||
# set virtual env path
|
||||
ENV \
|
||||
PATH=/venv/bin:$PATH
|
||||
@ -13,11 +18,15 @@ WORKDIR /app
|
||||
# copy app files to /app directory
|
||||
COPY ./app .
|
||||
|
||||
# install dependencies
|
||||
# set permissions to log directory and install dependencies
|
||||
RUN \
|
||||
chown -R ${USER}:${USER_GROUP} /app/log && \
|
||||
python -m venv /venv && \
|
||||
pip install -r requirements.txt
|
||||
|
||||
# set user to run application
|
||||
USER ${USER}:${USER_GROUP}
|
||||
|
||||
# start shell script when container starts
|
||||
ENTRYPOINT ["/app/run.sh"]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user