33 lines
971 B
Docker
33 lines
971 B
Docker
# syntax=docker/dockerfile:1
|
|
ARG PYTHON_VERSION=3.11
|
|
|
|
FROM python:${PYTHON_VERSION}-slim AS base
|
|
|
|
ENV PYTHONDONTWRITEBYTECODE=1 \
|
|
PYTHONUNBUFFERED=1
|
|
|
|
# Optional: Systemabhängigkeiten (Minimalsatz)
|
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
ca-certificates curl build-essential \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
WORKDIR /app
|
|
|
|
# Dependencies zuerst kopieren für bessere Layer-Caching-Effizienz
|
|
COPY requirements.txt /app/requirements.txt
|
|
RUN pip install --no-cache-dir -r /app/requirements.txt
|
|
|
|
# Anwendungscode
|
|
COPY . /app
|
|
|
|
# Non-root User
|
|
RUN useradd -m appuser && chown -R appuser:appuser /app
|
|
USER appuser
|
|
|
|
# Standard-Config-Pfad für die App-Factory (neue Struktur unter /app/app/config)
|
|
ENV APP_CONFIG_PATH=/app/app/config/config.yaml
|
|
|
|
EXPOSE 8000
|
|
|
|
# Start über Uvicorn-Factory aus neuer Struktur: app/start.py stellt app_factory() bereit
|
|
CMD ["uvicorn", "app.start:app_factory", "--factory", "--host", "0.0.0.0", "--port", "8000"] |