# Use Python 3.11 slim image FROM python:3.11-slim # Ensure Python output is sent straight to stdout/stderr (no buffering), # which is required for logs to appear in `docker logs`. ENV PYTHONUNBUFFERED=1 \ PYTHONDONTWRITEBYTECODE=1 # Set working directory WORKDIR /app # Install system dependencies if needed RUN apt-get update && apt-get install -y \ gcc \ && rm -rf /var/lib/apt/lists/* # Copy requirements and install Python dependencies COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt # Copy the source code COPY src/ ./src/ COPY data/ ./data/ # Create data and log directories if they don't exist RUN mkdir -p data logs # Expose port EXPOSE $APP_PORT # Run the application CMD python -m uvicorn src.main:app --host 0.0.0.0 --port $APP_PORT