52 lines
928 B
Docker
52 lines
928 B
Docker
FROM python:3.11-slim-bookworm AS install-dependencies
|
|
|
|
# create and set main app directory
|
|
WORKDIR /app
|
|
|
|
# set virtual env path
|
|
ENV \
|
|
PATH=/venv/bin:$PATH
|
|
|
|
# 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/requirements.txt .
|
|
|
|
# install dependencies && cleanup
|
|
RUN \
|
|
pip install -r requirements.txt
|
|
|
|
|
|
FROM python:3.11-slim-bookworm
|
|
|
|
# set virtual env path
|
|
ENV \
|
|
PATH=/venv/bin:$PATH
|
|
|
|
# does nothing, for documentation only
|
|
EXPOSE 3000
|
|
|
|
# create and set main app directory
|
|
WORKDIR /app
|
|
|
|
COPY --from=install-dependencies /venv /venv
|
|
|
|
# copy app files to /app directory
|
|
COPY ./app .
|
|
|
|
RUN ls -alF /
|
|
RUN ls -alF /venv
|
|
RUN ls -alF /venv/bin
|
|
RUN ls -alF /app
|
|
|
|
|
|
# start shell script when container starts
|
|
ENTRYPOINT ["/app/run.sh"]
|
|
|
|
# no additional parameters to run.sh script
|
|
CMD []
|