43 lines
887 B
Docker
43 lines
887 B
Docker
FROM python:3.14-slim AS builder
|
|
|
|
ENV PYTHONDONTWRITEBYTECODE=1 \
|
|
PYTHONUNBUFFERED=1 \
|
|
PIP_DISABLE_PIP_VERSION_CHECK=1
|
|
|
|
WORKDIR /app
|
|
|
|
RUN apt-get update \
|
|
&& apt-get install --yes --no-install-recommends build-essential gcc \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
COPY requirements.txt ./
|
|
|
|
RUN pip install --upgrade pip \
|
|
&& pip wheel --wheel-dir /wheels -r requirements.txt
|
|
|
|
|
|
FROM python:3.14-slim AS runtime
|
|
|
|
ENV PYTHONDONTWRITEBYTECODE=1 \
|
|
PYTHONUNBUFFERED=1 \
|
|
PIP_DISABLE_PIP_VERSION_CHECK=1
|
|
|
|
WORKDIR /app
|
|
|
|
RUN addgroup --system app && adduser --system --ingroup app app
|
|
|
|
COPY requirements.txt ./
|
|
COPY --from=builder /wheels /wheels
|
|
|
|
RUN pip install --no-cache-dir --no-index --find-links=/wheels -r requirements.txt \
|
|
&& rm -rf /wheels
|
|
|
|
COPY . .
|
|
|
|
RUN mkdir -p /app/static/img /app/images \
|
|
&& chown -R app:app /app
|
|
|
|
USER app
|
|
|
|
CMD ["python", "main.py"]
|