# ERP Nutzfahrzeuge — Backend Dockerfile # Python 3.13-slim + FastAPI + uvicorn # System packages: WeasyPrint (libpango, libcairo), Pillow (libjpeg, libpng) FROM python:3.13-slim AS base # --- System packages for WeasyPrint and Pillow --- RUN apt-get update && apt-get install -y --no-install-recommends \ libpango-1.0-0 \ libpangoft2-1.0-0 \ libcairo2 \ libgdk-pixbuf2.0-0 \ libjpeg62-turbo \ libpng16-16 \ libffi-dev \ curl \ && rm -rf /var/lib/apt/lists/* # --- Python venv --- RUN python -m venv /opt/venv ENV PATH="/opt/venv/bin:$PATH" ENV PYTHONDONTWRITEBYTECODE=1 ENV PYTHONUNBUFFERED=1 WORKDIR /app # --- Install dependencies first (better layer caching) --- COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt # --- Copy application code --- COPY . . # --- Create upload and contract directories --- RUN mkdir -p /data/uploads /tmp/contracts # --- Expose port --- EXPOSE 8000 # --- Health check --- HEALTHCHECK --interval=30s --timeout=5s --retries=3 --start-period=10s \ CMD curl -f http://localhost:8000/api/v1/health || exit 1 # --- Start command --- CMD ["python", "-m", "uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000", "--workers", "4"]