Dockerfile 712 B

12345678910111213141516171819202122232425262728293031
  1. # syntax=docker/dockerfile:1
  2. FROM registry.cn-hangzhou.aliyuncs.com/stuuudy/python:3.11-slim AS base
  3. ENV PYTHONDONTWRITEBYTECODE=1 \
  4. PYTHONUNBUFFERED=1 \
  5. PIP_DISABLE_PIP_VERSION_CHECK=1 \
  6. PIP_NO_CACHE_DIR=1
  7. WORKDIR /app
  8. # System deps
  9. # RUN apt-get update -y && apt-get install -y --no-install-recommends \
  10. # build-essential curl && \
  11. # rm -rf /var/lib/apt/lists/*
  12. # Install Python deps first (better layer caching)
  13. COPY requirements.txt .
  14. RUN pip install -r requirements.txt
  15. # Copy source
  16. COPY app ./app
  17. COPY README.md .
  18. # Optionally copy .env at build time (usually mounted at runtime)
  19. COPY .env .
  20. EXPOSE 8000
  21. CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]