Spaces:
Sleeping
Sleeping
| # --- Build Frontend --- | |
| FROM node:20-alpine AS frontend-builder | |
| WORKDIR /app | |
| COPY package*.json ./ | |
| RUN npm install | |
| COPY . . | |
| RUN npm run build | |
| # --- Build Backend & Run --- | |
| FROM python:3.11-slim | |
| WORKDIR /app | |
| # Install system dependencies including tesseract-ocr | |
| RUN apt-get update && apt-get install -y --no-install-recommends \ | |
| tesseract-ocr \ | |
| libtesseract-dev \ | |
| && apt-get clean \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Install Python requirements | |
| COPY ai-backend/requirements.txt ./ai-backend/requirements.txt | |
| RUN pip install --no-cache-dir -r ai-backend/requirements.txt | |
| # Copy backend files and built frontend | |
| COPY ai-backend/ ./ai-backend/ | |
| COPY --from=frontend-builder /app/dist ./dist | |
| # Expose port 8000 | |
| EXPOSE 8000 | |
| # Set entry point using gunicorn for production reliability | |
| WORKDIR /app/ai-backend | |
| CMD ["gunicorn", "--bind", "0.0.0.0:8000", "server:app"] | |