| # Use Node.js 18 Alpine for smaller size | |
| FROM node:18-alpine | |
| # Install dependencies needed for building | |
| RUN apk add --no-cache libc6-compat | |
| # Set working directory | |
| WORKDIR /app | |
| # Copy package files and install dependencies | |
| COPY package*.json ./ | |
| RUN npm ci | |
| # Copy source code | |
| COPY . . | |
| # Set build environment | |
| ENV NODE_ENV=production | |
| ENV NEXT_TELEMETRY_DISABLED=1 | |
| # Build the application | |
| RUN npm run build | |
| # Expose port 7860 (required by Hugging Face) | |
| EXPOSE 7860 | |
| # Set runtime environment | |
| ENV PORT=7860 | |
| ENV HOSTNAME=0.0.0.0 | |
| # Start the application | |
| CMD ["npm", "start"] | |