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