FastAPI-Backend und React-Frontend mit Konten, Sendungsverfolgung, Projekt-Artikeln, Vorrat & Einkauf mit Rezeptabgleich, Reise-Weltkarte, Kanban-Projekten mit Priorität, Server-Monitoring und den Designs Matrix und Blackwall. Betrieb per Docker hinter nginx (siehe DEPLOY.md). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
41 lines
1.3 KiB
Docker
41 lines
1.3 KiB
Docker
# P42 Dashboard – ein Container: FastAPI liefert API und das gebaute React-Frontend aus.
|
||
|
||
# ---------- 1. Frontend bauen ----------
|
||
FROM node:22-alpine AS frontend
|
||
WORKDIR /build
|
||
# Erst nur die Paketlisten, damit npm ci bei Code-Änderungen aus dem Cache kommt
|
||
COPY frontend/package.json frontend/package-lock.json ./
|
||
RUN npm ci
|
||
COPY frontend/ ./
|
||
RUN npm run build
|
||
|
||
# ---------- 2. Laufzeit ----------
|
||
FROM python:3.13-slim
|
||
|
||
ENV PYTHONDONTWRITEBYTECODE=1 \
|
||
PYTHONUNBUFFERED=1 \
|
||
TZ=Europe/Berlin \
|
||
HOST=0.0.0.0 \
|
||
PORT=3000 \
|
||
P42_DATA_DIR=/data
|
||
|
||
WORKDIR /app/backend
|
||
COPY backend/requirements.txt ./
|
||
RUN pip install --no-cache-dir -r requirements.txt
|
||
|
||
# Aufbau wie im Projekt: /app/backend/app, /app/frontend/dist, /app/config.json (wird eingebunden)
|
||
COPY backend/app ./app
|
||
COPY config.example.json /app/config.example.json
|
||
COPY --from=frontend /build/dist /app/frontend/dist
|
||
|
||
# Ohne Root-Rechte laufen; /data gehört dem Benutzer (UID 1000, wie im Datenordner auf dem Server)
|
||
RUN useradd --uid 1000 --create-home p42 && mkdir -p /data && chown p42:p42 /data
|
||
USER p42
|
||
|
||
EXPOSE 3000
|
||
|
||
HEALTHCHECK --interval=30s --timeout=5s --start-period=15s --retries=3 \
|
||
CMD python -c "import urllib.request,sys; sys.exit(0 if urllib.request.urlopen('http://127.0.0.1:3000/api/auth/status', timeout=4).status == 200 else 1)"
|
||
|
||
CMD ["python", "-m", "app"]
|