| 123456789101112131415161718192021222324 |
- # syntax=docker/dockerfile:1.4
- FROM python:3.12-slim
- # Allow configuring a faster pip index at build time (default: TUNA mirror)
- ARG PIP_INDEX_URL=https://pypi.tuna.tsinghua.edu.cn/simple
- ENV PYTHONDONTWRITEBYTECODE=1 \
- PYTHONUNBUFFERED=1 \
- PIP_INDEX_URL=$PIP_INDEX_URL
- WORKDIR /app
- # Copy only requirements first to maximise layer cache
- COPY requirements.txt ./
- # Use BuildKit cache mount for pip to avoid re-downloading wheels between builds.
- # Build with: DOCKER_BUILDKIT=1 docker build --build-arg PIP_INDEX_URL=... -t ginger .
- RUN --mount=type=cache,target=/root/.cache/pip \
- python -m pip install --upgrade pip setuptools wheel && \
- python -m pip install --prefer-binary -r requirements.txt
- COPY . .
- EXPOSE 5000
- CMD ["uwsgi", "--ini", "/app/uwsgi.ini"]
|