Jr SoulWolf commited on
Commit
8f02dbf
·
1 Parent(s): 9cd9b3d

Add initial Dockerfile for Docker-based Space

Browse files
Files changed (1) hide show
  1. Dockerfile +27 -0
Dockerfile ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Use a multi-stage build to optimize the image
2
+ # Stage 1: Build the React frontend
3
+ FROM node:18-alpine AS frontend-builder
4
+ WORKDIR /app
5
+ COPY frontend/package.json frontend/package-lock.json ./
6
+ RUN npm install
7
+ COPY frontend/ .
8
+ RUN npm run build
9
+
10
+ # Stage 2: Set up the FastAPI backend
11
+ FROM python:3.9-slim
12
+ WORKDIR /app
13
+ COPY backend/requirements.txt .
14
+ RUN pip install --no-cache-dir -r requirements.txt
15
+ COPY backend/ .
16
+ COPY --from=frontend-builder /app/dist/ ./frontend/dist/
17
+
18
+ # Expose port
19
+ EXPOSE 7860
20
+
21
+ # Environment variables
22
+ ENV GEMINI_API_KEY=${GEMINI_API_KEY}
23
+
24
+ # Run the app
25
+ CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
26
+
27
+