# Use Node 18 Alpine FROM node:18-alpine # 1. Create the user 'user' with ID 1000 (Required by Hugging Face) RUN adduser -D -u 1000 user # 2. Switch to that user and set the home directory USER user ENV HOME=/home/user \ PATH=/home/user/.local/bin:$PATH # 3. Set the working directory WORKDIR $HOME/app # 4. Copy package.json with correct permissions COPY --chown=user package*.json ./ # 5. Install dependencies RUN npm install # 6. Copy the rest of the application code COPY --chown=user . . # 7. EXPOSE PORT 7860 (Strictly required by Hugging Face) EXPOSE 7860 # 8. Start the app CMD ["node", "index.js"]