Spaces:
Running
Running
# 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;"] | |