File size: 589 Bytes
57053da
 
 
 
 
 
 
 
 
 
1af45d7
 
57053da
1af45d7
57053da
 
 
 
 
1af45d7
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# Stage 1: Build the React frontend
FROM node:18 AS frontend-build
WORKDIR /app/frontend
COPY frontend/package.json frontend/package-lock.json ./
RUN npm ci
COPY frontend ./
RUN npm run build

# Stage 2: Build the Python backend
FROM python:3.10-slim AS backend
WORKDIR /app
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
COPY . .

# Copy the built React frontend from the previous stage
COPY --from=frontend-build /app/frontend/build ./frontend/build

# Expose the port and run the FastAPI app
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]