30 lines
857 B
Docker
30 lines
857 B
Docker
FROM python:3.12.9-slim-bullseye AS builder
|
|
ENV PYTHONUNBUFFERED 1
|
|
COPY . ./
|
|
ENV POETRY_VERSION=2.1.1
|
|
RUN pip install pip==25.3
|
|
RUN pip install "poetry==$POETRY_VERSION"
|
|
RUN poetry self add poetry-plugin-export
|
|
RUN poetry export --without-hashes --format=requirements.txt --output requirements.txt
|
|
|
|
FROM python:3.12.9-slim-bullseye AS server
|
|
|
|
WORKDIR /app
|
|
COPY . ./
|
|
COPY --from=builder requirements.txt ./
|
|
|
|
ENV PYTHONUNBUFFERED=1 \
|
|
# prevents python creating .pyc files
|
|
PYTHONDONTWRITEBYTECODE=1 \
|
|
# pip
|
|
PIP_NO_CACHE_DIR=off \
|
|
PIP_DISABLE_PIP_VERSION_CHECK=on \
|
|
PIP_DEFAULT_TIMEOUT=100
|
|
|
|
RUN apt-get update && apt-get install --no-install-recommends -y build-essential
|
|
RUN pip install pip==25.3
|
|
RUN pip install --no-deps -r requirements.txt
|
|
|
|
RUN python manage.py collectstatic --noinput
|
|
CMD ["sh", "-c", "./production_entrypoint.sh"]
|