File size: 821 Bytes
f93287b
 
 
 
 
 
 
a985b94
f93287b
 
a985b94
 
 
 
 
f93287b
a985b94
 
 
f93287b
a985b94
 
 
f93287b
 
 
a985b94
 
 
 
 
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
# Stage 1: Build Frontend
FROM node:20 AS frontend-build
WORKDIR /app/frontend
COPY frontend/package*.json ./
RUN npm install
COPY frontend/ ./
RUN npm run build

# Stage 2: Backend & Serve
FROM python:3.12-slim
WORKDIR /app

# Install system dependencies
RUN apt-get update && apt-get install -y build-essential && rm -rf /var/lib/apt/lists/*

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

# Copy backend and middleware code
COPY backend/ ./backend/
COPY middleware/ ./middleware/

# Copy the built frontend from Stage 1
COPY --from=frontend-build /app/frontend/dist ./frontend/dist

# Hugging Face requires port 7860
EXPOSE 7860

# Start the server
CMD ["uvicorn", "backend.main:app", "--host", "0.0.0.0", "--port", "7860"]