2026-07-18 15:47:26 +02:00
|
|
|
# ERP Nutzfahrzeuge — Backend Dockerfile
|
|
|
|
|
# Python 3.13-slim + FastAPI + uvicorn
|
|
|
|
|
# System packages: WeasyPrint (libpango, libcairo), Pillow (libjpeg, libpng)
|
|
|
|
|
|
2026-07-18 17:03:44 +02:00
|
|
|
FROM python:3.12-slim AS base
|
2026-07-18 15:47:26 +02:00
|
|
|
|
|
|
|
|
# --- 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"]
|