| # Use a lightweight Node.js image | |
| FROM node:22-alpine | |
| # Hugging Face Spaces requires apps to run under a non-root user (UID 1000) | |
| # The 'node' user is built into this image with UID 1000 | |
| WORKDIR /app | |
| # Copy package files first to leverage Docker cache | |
| COPY package*.json ./ | |
| # Install dependencies | |
| RUN npm install | |
| # Copy the rest of your application code | |
| COPY . . | |
| # Grant the 'node' user ownership of the /app directory | |
| RUN chown -R node:node /app | |
| # Switch to the non-root user | |
| USER node | |
| # Hugging Face Spaces route traffic to port 7860 by default | |
| ENV PORT=7860 | |
| EXPOSE 7860 | |
| # Start the RollyBeans engine | |
| CMD ["node", "index.js"] | |