| FROM node:18-alpine | |
| WORKDIR /app | |
| # Copy dependency definitions | |
| COPY package*.json ./ | |
| # Install dependencies | |
| RUN npm install | |
| # Copy all files | |
| COPY . . | |
| # Build the Next.js app | |
| RUN npm run build | |
| # Copy standalone output | |
| RUN cp -r .next/standalone ./standalone | |
| RUN cp -r .next/static ./standalone/.next/static | |
| RUN cp -r public ./standalone/public | |
| # Expose port 7860 (Required for Hugging Face Spaces) | |
| EXPOSE 7860 | |
| ENV PORT=7860 | |
| # Switch to standalone directory | |
| WORKDIR /app/standalone | |
| # Start the application | |
| CMD ["node", "server.js"] |