FROM node:20-slim # Install required system dependencies RUN apt-get update && apt-get install -y --no-install-recommends \ git \ curl \ && rm -rf /var/lib/apt/lists/* # The node image likely already has a user with UID 1000 # We'll just use that user instead of creating a new one # Find out the username with UID 1000 RUN USER_1000=$(getent passwd 1000 | cut -d: -f1) || echo "No user with UID 1000" # Switch to the user with UID 1000 USER node # Set the working directory WORKDIR $HOME/app # Copy package.json and package-lock.json first for better caching COPY --chown=node package*.json ./ # Install dependencies RUN npm install # Copy the current directory contents into the container COPY --chown=node . $HOME/app # Make port 7860 available outside the container EXPOSE 7860 # Create a directory for temporary data (if needed) RUN mkdir -p /tmp/data RUN chmod 777 /tmp/data # Run the server CMD ["node", "server.js"]