Spaces:
Sleeping
Sleeping
File size: 1,386 Bytes
96dd01c | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | # ------------------------------------
# STAGE 1: Build the React Frontend
# ------------------------------------
FROM node:20-slim AS frontend-build
WORKDIR /app/Agent_Frontend
# Copy the frontend dependencies definition
COPY Agent_Frontend/package*.json ./
# Install dependencies
RUN npm install
# Copy all the frontend source files
COPY Agent_Frontend/ ./
# Build the React application
RUN npm run build
# ------------------------------------
# STAGE 2: Build the FastAPI Backend
# ------------------------------------
FROM python:3.11-slim
WORKDIR /app
# Install system dependencies
# Tesseract OCR is needed for the pytesseract library you are using
RUN apt-get update && apt-get install -y \
tesseract-ocr \
libtesseract-dev \
&& rm -rf /var/lib/apt/lists/*
# Copy backend requirements and install Python dependencies
COPY Agent_Backend/requirements.txt ./Agent_Backend/
RUN pip install --no-cache-dir -r Agent_Backend/requirements.txt
# Copy the backend code into the container
COPY Agent_Backend/ ./Agent_Backend/
# Copy the compiled frontend build from the first stage
COPY --from=frontend-build /app/Agent_Frontend/dist ./Agent_Frontend/dist
# Expose port 7860 which is the port Hugging Face Spaces expects
EXPOSE 7860
# Run the FastAPI server via Uvicorn on port 7860
CMD ["uvicorn", "Agent_Backend.main:app", "--host", "0.0.0.0", "--port", "7860"]
|