File size: 972 Bytes
c450d92
 
1e66b23
c450d92
2678c75
1e66b23
 
c450d92
 
1e66b23
 
2678c75
 
f5fd3e6
c450d92
 
 
f5fd3e6
 
c450d92
 
 
f5fd3e6
c450d92
 
1e66b23
2678c75
 
 
f5fd3e6
 
 
c450d92
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
# --------- 1) Build frontend (React + Vite) ----------
FROM node:18 AS frontend-builder
WORKDIR /frontend

# Install dependencies for frontend
COPY frontend/package.json frontend/package-lock.json* ./
RUN npm install

# Copy the rest of the frontend and build
COPY frontend .
RUN npm run build
# NOTE: Your Vite config is writing output to ../app/frontend_dist
# So in this builder image, the built files are at: /app/frontend_dist

# --------- 2) Backend (FastAPI + Python) ----------
FROM python:3.11-slim

WORKDIR /app

# Install backend dependencies
COPY app/requirements.txt /app/requirements.txt
RUN pip install --no-cache-dir -r /app/requirements.txt

# Copy backend code
COPY app /app

# Copy built frontend from builder image into this final image
# IMPORTANT: we copy from /app/frontend_dist (not /frontend/dist)
COPY --from=frontend-builder /app/frontend_dist /app/frontend_dist

EXPOSE 7860

CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]