Files
minmal-file-cloud-email-pim…/Dockerfile
T
Stefan Hacker 3af2bc3312 fix: SSE blockiert gunicorn-Worker - auf gthread umstellen
Mit 4 synchronen Workern hielt jede SSE-Verbindung dauerhaft einen
ganzen Worker besetzt. 4 offene Browser-Tabs -> alle anderen
Requests blockiert -> "Dateien laden dauert ewig".

Loesung: gthread worker-class mit 2 Workern x 16 Threads = 32
gleichzeitige Slots. Lang laufende SSE-Streams belegen nur je
einen Thread, regulaere Requests laufen unbeeintraechtigt.

nginx.example.conf: separater Location-Block fuer /api/sync/events
mit proxy_buffering off und 24h Read-Timeout, damit die Events
sofort durchkommen und die Verbindung nicht abbricht.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-12 10:33:02 +02:00

44 lines
1.1 KiB
Docker

# Stage 1: Build frontend
FROM node:22-slim AS frontend-build
WORKDIR /build
COPY frontend/package*.json ./
RUN npm ci
COPY frontend/ ./
RUN npm run build
# Stage 2: Production
FROM python:3.11-slim
WORKDIR /app
# Install system dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
gcc \
&& rm -rf /var/lib/apt/lists/*
# Install Python dependencies
COPY backend/requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt gunicorn
# Copy backend
COPY backend/ ./
# Copy frontend build
COPY --from=frontend-build /build/dist ./static
# Create data directory
RUN mkdir -p /app/data/files
# Environment
ENV FLASK_ENV=production
ENV DATABASE_PATH=/app/data/minicloud.db
ENV UPLOAD_PATH=/app/data/files
EXPOSE 5000
# gthread worker class so SSE long-poll connections don't starve regular requests.
# 2 workers x 16 threads = 32 concurrent slots; each SSE client just holds one thread.
CMD ["gunicorn", "--bind", "0.0.0.0:5000", \
"--worker-class", "gthread", "--workers", "2", "--threads", "16", \
"--timeout", "120", "--keep-alive", "65", \
"wsgi:application"]