srinuksv commited on
Commit
16fd774
·
verified ·
1 Parent(s): a6306af

Create Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +24 -0
Dockerfile ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Stage 1: Build the React app
2
+ FROM node:18 AS build
3
+
4
+ WORKDIR /app/frontend
5
+ COPY frontend/package.json ./
6
+ RUN npm install
7
+ COPY frontend/src ./src
8
+ RUN npm run build
9
+
10
+ # Stage 2: Set up FastAPI
11
+ FROM python:3.12-slim
12
+
13
+ WORKDIR /app
14
+
15
+ # Install FastAPI and Uvicorn
16
+ COPY app/requirements.txt ./
17
+ RUN pip install --no-cache-dir -r requirements.txt
18
+
19
+ # Copy the built React app from the previous stage
20
+ COPY --from=build /app/frontend/build ./frontend/build
21
+ COPY app/main.py ./app/
22
+
23
+ # Command to run the FastAPI app
24
+ CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]