# Use a slim version of Node.js for a smaller image size FROM node:20-slim # Set the working directory WORKDIR /app # Create a non-root user with UID 1000 (Hugging Face requirement) RUN useradd -m -u 1560 user # Copy package files and install dependencies COPY --chown=user package*.json ./ RUN npm install # Copy the rest of the application code COPY --chown=user . . # Switch to the non-root user USER user # Set environment variables (Hugging Face default port is 7860) ENV PORT=7860 EXPOSE 7860 # Start the application CMD ["node", "index.js"]