File size: 846 Bytes
bc663e4
 
 
caf7a63
bc663e4
be9292f
ecbdbe1
 
be9292f
19bfa62
be9292f
 
bc663e4
 
 
be9292f
 
 
 
 
 
 
bc663e4
 
be9292f
caf7a63
bc663e4
caf7a63
 
be9292f
 
bc663e4
774321b
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
# Stage 1: Build the React Client
# Use Node.js 20 as required by Vite and its dependencies
FROM node:20-alpine AS client-builder

WORKDIR /app/client
COPY client/package*.json ./
RUN npm install

COPY client/ .
# Build for production
RUN npm run build

# Stage 2: Final Production Image
# Use Python 3.9 for consistency with local dev setup
FROM python:3.9-slim

WORKDIR /app

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

# Copy the broker server code
COPY server/main.py .

# Copy built client static files from Stage 2
COPY --from=client-builder /app/client/dist /app/static

# Expose Hugging Face Spaces port
EXPOSE 7860

# Run the Uvicorn server, which will serve both the API broker and the static client.
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]