2023-04-25 11:44:02 +03:00
|
|
|
# define an alias for the specific python version used in this file.
|
2024-08-08 08:12:57 +03:00
|
|
|
FROM docker.io/python:3.12.5-slim-bookworm AS python
|
2021-12-24 14:55:47 +03:00
|
|
|
|
|
|
|
|
|
|
|
# Python build stage
|
2024-06-24 13:35:27 +03:00
|
|
|
FROM python AS python-build-stage
|
2020-04-24 17:23:41 +03:00
|
|
|
|
2024-07-18 23:07:44 +03:00
|
|
|
ENV PYTHONDONTWRITEBYTECODE=1
|
2020-04-24 17:23:41 +03:00
|
|
|
|
2021-12-24 14:55:47 +03:00
|
|
|
RUN apt-get update && apt-get install --no-install-recommends -y \
|
|
|
|
# dependencies for building Python packages
|
|
|
|
build-essential \
|
2024-03-26 18:47:02 +03:00
|
|
|
# psycopg dependencies
|
2021-12-24 14:55:47 +03:00
|
|
|
libpq-dev \
|
|
|
|
# cleaning up unused files
|
|
|
|
&& apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \
|
|
|
|
&& rm -rf /var/lib/apt/lists/*
|
2020-04-24 17:23:41 +03:00
|
|
|
|
|
|
|
# Requirements are installed here to ensure they will be cached.
|
|
|
|
COPY ./requirements /requirements
|
2021-12-24 14:55:47 +03:00
|
|
|
|
|
|
|
# create python dependency wheels
|
2022-09-24 16:37:12 +03:00
|
|
|
RUN pip wheel --no-cache-dir --wheel-dir /usr/src/app/wheels \
|
2021-12-24 14:55:47 +03:00
|
|
|
-r /requirements/local.txt -r /requirements/production.txt \
|
|
|
|
&& rm -rf /requirements
|
|
|
|
|
|
|
|
|
|
|
|
# Python 'run' stage
|
2024-06-24 13:35:27 +03:00
|
|
|
FROM python AS python-run-stage
|
2021-12-24 14:55:47 +03:00
|
|
|
|
|
|
|
ARG BUILD_ENVIRONMENT
|
2024-07-18 23:07:44 +03:00
|
|
|
ENV PYTHONUNBUFFERED=1
|
|
|
|
ENV PYTHONDONTWRITEBYTECODE=1
|
2021-12-24 14:55:47 +03:00
|
|
|
|
|
|
|
RUN apt-get update && apt-get install --no-install-recommends -y \
|
2021-12-24 22:13:43 +03:00
|
|
|
# To run the Makefile
|
|
|
|
make \
|
2024-03-26 18:47:02 +03:00
|
|
|
# psycopg dependencies
|
2021-12-26 19:04:33 +03:00
|
|
|
libpq-dev \
|
2021-12-24 14:55:47 +03:00
|
|
|
# Translations dependencies
|
|
|
|
gettext \
|
|
|
|
# Uncomment below lines to enable Sphinx output to latex and pdf
|
|
|
|
# texlive-latex-recommended \
|
|
|
|
# texlive-fonts-recommended \
|
|
|
|
# texlive-latex-extra \
|
|
|
|
# latexmk \
|
|
|
|
# cleaning up unused files
|
|
|
|
&& apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \
|
|
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
|
|
|
|
# copy python dependency wheels from python-build-stage
|
|
|
|
COPY --from=python-build-stage /usr/src/app/wheels /wheels
|
|
|
|
|
|
|
|
# use wheels to install python dependencies
|
|
|
|
RUN pip install --no-cache /wheels/* \
|
|
|
|
&& rm -rf /wheels
|
2020-04-24 17:23:41 +03:00
|
|
|
|
2020-11-04 20:17:02 +03:00
|
|
|
COPY ./compose/local/docs/start /start-docs
|
|
|
|
RUN sed -i 's/\r$//g' /start-docs
|
|
|
|
RUN chmod +x /start-docs
|
2020-04-24 17:23:41 +03:00
|
|
|
|
2020-11-04 20:17:02 +03:00
|
|
|
WORKDIR /docs
|