File size: 775 Bytes
74791b6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 the React application
FROM node:20-alpine AS builder
RUN apk add --no-cache libc6-compat

WORKDIR /app

# 1) Copy package files & install
COPY frontend/package.json frontend/package-lock.json ./
RUN npm install

# 2) Copy source & build into dist/
COPY frontend ./
RUN npm run build

# Stage 2: Serve the React build with Nginx
FROM bitnami/nginx:1.26.1

WORKDIR /app

# 1) Copy your custom Nginx config
#    (make sure your nginx.conf listens on 7860 and points root to /usr/share/nginx/html)
COPY nginx.conf /opt/bitnami/nginx/conf/nginx.conf

# 2) Copy the static build from the builder
COPY --from=builder /app/dist /usr/share/nginx/html

# 3) Expose the HF Spaces port
EXPOSE 7860

# 4) Launch Nginx in the foreground
CMD ["nginx", "-g", "daemon off;"]