44 lines
1.5 KiB
Docker
44 lines
1.5 KiB
Docker
# ── Stage 1: React-Frontend bauen ───────────────────────────────────────────
|
|
FROM node:20-alpine AS frontend-builder
|
|
# /repo entspricht dem Repo-Root im Build-Context
|
|
WORKDIR /repo/frontend
|
|
COPY frontend/package*.json ./
|
|
RUN npm ci --silent
|
|
COPY frontend/ .
|
|
# vite.config outDir: ../static/react → schreibt nach /repo/static/react
|
|
RUN npm run build
|
|
|
|
# ── Stage 2: Python/Flask Backend ────────────────────────────────────────────
|
|
FROM python:3.12-slim
|
|
WORKDIR /app
|
|
|
|
# Bildcodec-Abhängigkeiten für Pillow
|
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
libjpeg-dev libpng-dev libwebp-dev \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# Python-Pakete
|
|
COPY requirements.txt .
|
|
RUN pip install --no-cache-dir -r requirements.txt
|
|
|
|
# Anwendungscode
|
|
COPY app.py .
|
|
COPY prompts/ prompts/
|
|
COPY templates/ templates/
|
|
|
|
# Leeres static/ vorbereiten, dann React-Build einfügen
|
|
RUN mkdir -p static/react
|
|
COPY --from=frontend-builder /repo/static/react ./static/react
|
|
|
|
# Datenverzeichnisse (in Coolify als Volumes konfigurieren)
|
|
RUN mkdir -p pictures objects_image sentence_object
|
|
|
|
# Ollama-Verbindung: Standard → Ollama auf dem Host-Gerät
|
|
# In Coolify als Umgebungsvariable überschreibbar
|
|
ENV OLLAMA_HOST=http://host.docker.internal:11434
|
|
ENV PYTHONUNBUFFERED=1
|
|
|
|
EXPOSE 8000
|
|
|
|
CMD ["gunicorn", "--bind", "0.0.0.0:8000", "--workers", "2", "--timeout", "120", "app:app"]
|