Dockerfile 833 B

123456789101112131415161718192021222324252627282930
  1. FROM python:3.11-slim
  2. # Prevent Python from writing .pyc files and ensure stdout/stderr are unbuffered
  3. ENV PYTHONDONTWRITEBYTECODE=1 \
  4. PYTHONUNBUFFERED=1 \
  5. PIP_NO_CACHE_DIR=1
  6. # Install system dependencies (ffmpeg for media handling, curl for health/debug)
  7. RUN apt-get update && apt-get install -y --no-install-recommends \
  8. ffmpeg \
  9. curl \
  10. ca-certificates \
  11. && rm -rf /var/lib/apt/lists/*
  12. WORKDIR /app
  13. # Install Python dependencies first for better layer caching
  14. COPY requirements.txt /app/requirements.txt
  15. RUN pip install --upgrade pip && pip install -r /app/requirements.txt
  16. # Copy the rest of the source code
  17. COPY . /app
  18. # Default envs (override via compose/.env)
  19. ENV TZ=Asia/Shanghai \
  20. PYTHONPATH=/app
  21. # Default command is a no-op; each service overrides with its own command
  22. CMD ["python", "-V"]