FROM node:22-alpine AS build # Set the working directory WORKDIR /app # Copy package files first for better caching COPY package*.json ./ # Install dependencies RUN npm install --legacy-peer-deps # Copy the rest of the application COPY . . # Build the application RUN npm run build # Second stage: Serve the application with a lightweight HTTP server FROM node:22-alpine WORKDIR /app # Install 'serve' tool to host static files RUN npm install -g serve # Copy only the built files from the build stage COPY --from=build /app/dist ./dist # Hugging Face Spaces expect port 7860 EXPOSE 7860 # Command to serve the static site on port 7860 CMD ["serve", "-s", "dist", "-l", "7860"]