41 lines
846 B
Docker
41 lines
846 B
Docker
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
|
|
|
|
# does nothing, for documentation only
|
|
EXPOSE 3000
|
|
|
|
# create and set main app directory
|
|
WORKDIR /app
|
|
|
|
# install sys libs and create virtual env
|
|
RUN \
|
|
apt update && \
|
|
apt install -y gcc libpq-dev python3-dev && \
|
|
python -m venv /venv
|
|
|
|
# copy app files to /app directory
|
|
COPY ./app .
|
|
|
|
# set permissions to log directory and install dependencies && cleanup
|
|
RUN \
|
|
chown -R ${USER}:${USER_GROUP} /app/log && \
|
|
pip install -r requirements.txt && \
|
|
apt purge --auto-remove -y
|
|
|
|
# set user to run application
|
|
USER ${USER}:${USER_GROUP}
|
|
|
|
# start shell script when container starts
|
|
ENTRYPOINT ["/app/run.sh"]
|
|
|
|
# no additional parameters to run.sh script
|
|
CMD []
|