File size: 574 Bytes
16fd774
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
# Stage 1: Build the React app
FROM node:18 AS build

WORKDIR /app/frontend
COPY frontend/package.json ./
RUN npm install
COPY frontend/src ./src
RUN npm run build

# Stage 2: Set up FastAPI
FROM python:3.12-slim

WORKDIR /app

# Install FastAPI and Uvicorn
COPY app/requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt

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

# Command to run the FastAPI app
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]