File size: 553 Bytes
8b4a65b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
FROM node:20 AS builder
WORKDIR /app
COPY frontends/react/package*.json ./frontends/react/
RUN cd frontends/react && npm install
COPY . .
RUN cd frontends/react && npm run build

# Step 2: Serve it with npx
FROM node:20-slim
WORKDIR /app
# Only copy the built files from the builder
COPY --from=builder /app/frontends/react/dist ./dist

# Install the server tool
RUN npm install -g serve

# Serve the 'dist' folder on the correct Hugging Face port
# -s flag handles Single Page App routing (important for React)
CMD ["serve", "-s", "dist", "-l", "7860"]