mirror of
https://gitea.mueller.network/extern/django-helpdesk.git
synced 2024-12-25 16:18:51 +01:00
45 lines
1.1 KiB
Docker
45 lines
1.1 KiB
Docker
ARG PYTHON_VERSION=3.11.5-slim-bookworm
|
|
|
|
# define an alias for the specfic python version used in this file.
|
|
FROM python:${PYTHON_VERSION} as python
|
|
|
|
FROM python as python-build-stage
|
|
|
|
# Install apt packages
|
|
RUN apt-get update && apt-get install --no-install-recommends -y \
|
|
# dependencies for building Python packages
|
|
build-essential
|
|
|
|
# Requirements are installed here to ensure they will be cached.
|
|
COPY ./requirements.txt ./requirements-dev.txt /
|
|
|
|
# Create Python Dependency and Sub-Dependency Wheels
|
|
RUN pip wheel --wheel-dir /usr/src/app/wheels \
|
|
-r requirements.txt \
|
|
-r requirements-dev.txt
|
|
|
|
FROM python as python-run-stage
|
|
|
|
ARG APP_HOME=/app
|
|
|
|
ENV PYTHONUNBUFFERED 1
|
|
ENV PYTHONDONTWRITEBYTECODE 1
|
|
|
|
WORKDIR ${APP_HOME}
|
|
|
|
COPY --from=python-build-stage /usr/src/app/wheels /wheels/
|
|
|
|
# use wheels to install python dependencies
|
|
RUN pip install --no-cache-dir --no-index --find-links=/wheels/ /wheels/* \
|
|
&& rm -rf /wheels/
|
|
|
|
COPY ./entrypoint /entrypoint
|
|
RUN sed -i 's/\r$//g' /entrypoint && chmod +x /entrypoint
|
|
|
|
FROM python-run-stage AS backend
|
|
|
|
# copy application code to WORKDIR
|
|
COPY . ${APP_HOME}
|
|
|
|
ENTRYPOINT ["/entrypoint"]
|