# Build stage FROM node:20-slim AS builder WORKDIR /app # Copy package files COPY package.json yarn.lock ./ # Install dependencies RUN yarn install --frozen-lockfile # Copy source code COPY . . # Build the app RUN yarn build # Production stage - nginx with dev mode support FROM nginx:bookworm # Install required packages for HF Spaces Dev Mode RUN apt-get update && \ apt-get install -y \ bash \ git git-lfs \ wget curl procps \ htop vim nano && \ rm -rf /var/lib/apt/lists/* # Setup /app directory for Dev Mode compatibility WORKDIR /app # Remove default nginx config RUN rm /etc/nginx/conf.d/default.conf 2>/dev/null || true # Copy custom nginx config COPY nginx.conf /etc/nginx/conf.d/default.conf # Copy built files from builder stage COPY --from=builder /app/dist /usr/share/nginx/html # Copy source for Dev Mode (so you can edit and rebuild) COPY --from=builder /app /app # Make /app owned by user 1000 for Dev Mode RUN chown -R 1000:1000 /app # Expose port EXPOSE 7860 # Use CMD (required by Dev Mode, not ENTRYPOINT) CMD ["nginx", "-g", "daemon off;"]