super-mario / Dockerfile
asemxin
Fix: Use multi-stage Docker build for HF Spaces
68a9f2f
raw
history blame contribute delete
586 Bytes
# Stage 1: Build the Next.js static export
FROM node:20-alpine AS builder
WORKDIR /app
# Copy package files
COPY package*.json ./
# Install dependencies
RUN npm ci
# Copy source code
COPY . .
# Build static export (generates 'out' directory)
RUN npm run build
# Stage 2: Serve with nginx
FROM nginx:alpine
# Copy custom nginx config
COPY nginx.conf /etc/nginx/nginx.conf
# Copy static files from builder stage
COPY --from=builder /app/out /usr/share/nginx/html/
# Expose port 7860 (required by Hugging Face Spaces)
EXPOSE 7860
# Start nginx
CMD ["nginx", "-g", "daemon off;"]