Spaces:
Paused
Paused
| # Use the official Node.js runtime as the base image | |
| FROM node:18-alpine | |
| # Set the working directory in the container | |
| WORKDIR /app | |
| # Copy package.json and package-lock.json (if available) | |
| COPY package*.json ./ | |
| # Install dependencies - use npm install if package-lock.json doesn't exist | |
| RUN npm install --omit=dev | |
| # Copy the rest of the application code | |
| COPY . . | |
| # Create a non-root user to run the app | |
| RUN addgroup -g 1001 -S nodejs | |
| RUN adduser -S nextjs -u 1001 | |
| # Change ownership of the app directory to the nodejs user | |
| RUN chown -R nextjs:nodejs /app | |
| USER nextjs | |
| # Expose the port the app runs on | |
| EXPOSE 7860 | |
| # Define environment variable for the port (HF Spaces uses 7860) | |
| ENV PORT=7860 | |
| # Start the application | |
| CMD ["npm", "start"] |