Dockerfile 781 B

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