43 lines
1.1 KiB
Docker
43 lines
1.1 KiB
Docker
# server/Dockerfile
|
|
# Produktions-Dockerfile für die Flask-API mit Gunicorn
|
|
|
|
# --- Basisimage ---
|
|
FROM python:3.13-slim
|
|
|
|
# --- Arbeitsverzeichnis ---
|
|
WORKDIR /app
|
|
|
|
# --- Systemabhängigkeiten für MariaDB-Client & Locale ---
|
|
RUN apt-get update \
|
|
&& apt-get install -y --no-install-recommends \
|
|
libmariadb-dev-compat libmariadb-dev locales git\
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# --- Locale konfigurieren ---
|
|
RUN sed -i 's/# de_DE.UTF-8 UTF-8/de_DE.UTF-8 UTF-8/' /etc/locale.gen \
|
|
&& locale-gen
|
|
ENV LANG=de_DE.UTF-8 \
|
|
LC_ALL=de_DE.UTF-8
|
|
|
|
# --- Python-Abhängigkeiten ---
|
|
COPY requirements.txt .
|
|
RUN pip install --no-cache-dir -r requirements.txt
|
|
|
|
# --- Applikationscode ---
|
|
COPY server/ /app
|
|
|
|
# --- Non-Root User anlegen und Rechte setzen ---
|
|
ARG USER_ID=1000
|
|
ARG GROUP_ID=1000
|
|
RUN groupadd -g ${GROUP_ID} infoscreen_taa \
|
|
&& useradd -u ${USER_ID} -g ${GROUP_ID} \
|
|
--shell /bin/bash --create-home infoscreen_taa \
|
|
&& chown -R infoscreen_taa:infoscreen_taa /app
|
|
USER infoscreen_taa
|
|
|
|
# --- Port für die API exposed ---
|
|
EXPOSE 8000
|
|
|
|
# --- Startbefehl für Gunicorn ---
|
|
CMD ["gunicorn", "-w", "4", "-b", "0.0.0.0:8000", "wsgi:app"]
|