FROM node:20-alpine # Set up the working directory inside the pre-existing node user's home WORKDIR /home/node/app # Copy dependency configs and adjust ownership to the 'node' user COPY --chown=node:node package*.json ./ RUN npm install # Copy the rest of your server code COPY --chown=node:node . . # Switch to the non-root node user for Hugging Face security USER node # Expose the mandatory Hugging Face port EXPOSE 7860 ENV PORT=7860 CMD ["node", "server.js"]