Spaces:
Sleeping
Sleeping
| FROM node:22-bookworm-slim AS frontend-builder | |
| WORKDIR /app | |
| ENV NEXT_TELEMETRY_DISABLED=1 | |
| ENV BACKEND_API_URL=http://127.0.0.1:8000 | |
| COPY package.json package-lock.json ./ | |
| RUN npm ci | |
| COPY app ./app | |
| COPY components ./components | |
| COPY public ./public | |
| COPY next.config.ts ./ | |
| COPY next-env.d.ts ./ | |
| COPY tsconfig.json ./ | |
| COPY postcss.config.js ./ | |
| COPY tailwind.config.ts ./ | |
| RUN npm run build | |
| FROM python:3.13-slim AS backend-builder | |
| WORKDIR /app/backend | |
| COPY backend/requirements.txt ./ | |
| RUN python -m venv /opt/venv \ | |
| && /opt/venv/bin/pip install --upgrade pip \ | |
| && /opt/venv/bin/pip install --no-cache-dir -r requirements.txt | |
| COPY backend/app ./app | |
| FROM python:3.13-slim AS runtime | |
| COPY --from=node:22-bookworm-slim /usr/local /usr/local | |
| ENV PATH="/opt/venv/bin:$PATH" | |
| ENV PYTHONUNBUFFERED=1 | |
| ENV NEXT_TELEMETRY_DISABLED=1 | |
| ENV PORT=7860 | |
| ENV HOSTNAME=0.0.0.0 | |
| WORKDIR /app | |
| COPY --from=backend-builder /opt/venv /opt/venv | |
| COPY --from=backend-builder /app/backend /app/backend | |
| COPY --from=frontend-builder /app/.next/standalone /app/frontend | |
| COPY --from=frontend-builder /app/.next/static /app/frontend/.next/static | |
| COPY --from=frontend-builder /app/public /app/frontend/public | |
| COPY scripts/start-prod.sh /app/start-prod.sh | |
| RUN chmod +x /app/start-prod.sh | |
| EXPOSE 7860 | |
| CMD ["/app/start-prod.sh"] | |