| FROM node:20-bookworm-slim AS frontend-build | |
| WORKDIR /frontend | |
| COPY frontend/package.json frontend/package-lock.json ./ | |
| RUN npm ci | |
| COPY frontend/ ./ | |
| RUN npm run build | |
| FROM python:3.11-slim AS runtime | |
| ENV PYTHONDONTWRITEBYTECODE=1 \ | |
| PYTHONUNBUFFERED=1 \ | |
| PORT=7860 | |
| WORKDIR /app | |
| RUN apt-get update && apt-get install -y --no-install-recommends libgomp1 \ | |
| && rm -rf /var/lib/apt/lists/* | |
| COPY requirements.txt ./ | |
| RUN pip install --no-cache-dir --upgrade pip && \ | |
| pip install --no-cache-dir torch --index-url https://download.pytorch.org/whl/cpu && \ | |
| pip install --no-cache-dir -r requirements.txt | |
| COPY . ./ | |
| COPY --from=frontend-build /frontend/dist ./frontend/dist | |
| EXPOSE 7860 | |
| CMD ["python", "start.py"] |