| FROM node:22-alpine AS frontend-builder | |
| WORKDIR /app/frontend | |
| COPY frontend/package.json frontend/package-lock.json ./ | |
| RUN npm ci | |
| COPY frontend/ ./ | |
| RUN npm run build | |
| FROM python:3.13-slim AS runtime | |
| ENV PYTHONDONTWRITEBYTECODE=1 \ | |
| PYTHONUNBUFFERED=1 \ | |
| PORT=7860 \ | |
| DATABASE_URL=sqlite:////data/cronogramas_v2.db | |
| WORKDIR /app | |
| COPY backend/requirements.txt /tmp/requirements.txt | |
| RUN pip install --no-cache-dir -r /tmp/requirements.txt | |
| COPY backend/ /app/backend/ | |
| COPY --from=frontend-builder /app/frontend/dist /app/frontend/dist | |
| COPY docker/start.sh /app/docker/start.sh | |
| RUN chmod +x /app/docker/start.sh && mkdir -p /data | |
| EXPOSE 7860 | |
| CMD ["/app/docker/start.sh"] | |