Spaces:
Sleeping
Sleeping
| # --- STAGE 1: Frontend Build --- | |
| FROM node:18-alpine AS frontend-builder | |
| WORKDIR /app | |
| # Copy package files (package-lock.json* = optional wenn nicht vorhanden) | |
| COPY package.json package-lock.json* ./ | |
| # Use npm install (npm ci braucht package-lock.json und würde sonst fehlschlagen) | |
| RUN npm install | |
| # Copy nur notwendige Dateien für Frontend-Build | |
| COPY src ./src | |
| COPY vite.config.js index.html ./ | |
| # Build React | |
| RUN npm run build | |
| # --- STAGE 2: Backend --- | |
| FROM python:3.10-slim | |
| WORKDIR /app | |
| # Minimal system deps - optional wenn torch/numpy C-Extensions braucht: | |
| # RUN apt-get update && apt-get install -y --no-install-recommends \ | |
| # build-essential \ | |
| # && rm -rf /var/lib/apt/lists/* | |
| # Python dependencies | |
| COPY requirements.txt . | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # Backend & Plugins | |
| COPY app_fastapi.py ./app.py | |
| COPY serve_frontend.py . | |
| COPY plugins ./plugins/ | |
| # Built Frontend von Stage 1 | |
| COPY --from=frontend-builder /app/dist ./dist | |
| EXPOSE 7860 | |
| # Start Backend | |
| CMD ["python", "app.py"] |