Spaces:
Running
Running
| FROM node:20-alpine AS frontend-builder | |
| WORKDIR /app | |
| COPY web/package.json web/package-lock.json ./ | |
| RUN npm ci | |
| COPY web/ . | |
| ENV NEXT_PUBLIC_API_URL="" | |
| RUN npm run build | |
| FROM node:20-bookworm-slim | |
| WORKDIR /app | |
| # Install system dependencies for backend runtime | |
| RUN apt-get update && apt-get install -y \ | |
| python3 \ | |
| python3-pip \ | |
| python3-venv \ | |
| redis-server \ | |
| git \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Install Python dependencies for CrewAI and FastAPI | |
| COPY requirements.txt . | |
| RUN python3 -m venv /opt/venv \ | |
| && /opt/venv/bin/pip install --no-cache-dir --upgrade pip \ | |
| && /opt/venv/bin/pip install --no-cache-dir -r requirements.txt | |
| ENV PATH="/opt/venv/bin:$PATH" | |
| # Copy backend code | |
| COPY . . | |
| # Copy Next.js build artifacts from previous stage | |
| COPY --from=frontend-builder /app/.next /app/web/.next | |
| COPY --from=frontend-builder /app/node_modules /app/web/node_modules | |
| COPY --from=frontend-builder /app/public /app/web/public | |
| COPY --from=frontend-builder /app/package.json /app/web/package.json | |
| # Permissions | |
| RUN chmod +x start.sh | |
| # Environment variables | |
| # Hugging Face Spaces mandatory port | |
| ENV PORT=7860 | |
| #EXPOSE 7860 | |
| CMD ["./start.sh"] | |