Spaces:
Sleeping
Sleeping
File size: 1,073 Bytes
70b7b2b | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | # --- 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"] |