# Use an official Node.js runtime as a parent image # Alpine Linux is chosen for its small size FROM node:20-alpine # Set the working directory in the container WORKDIR /app # Copy package.json and package-lock.json (if available) COPY package*.json ./ # Install app dependencies using npm ci for faster, reliable builds # Use --only=production to avoid installing devDependencies RUN npm ci --only=production # Copy the rest of the application code COPY . . # Make port 3000 available to the world outside this container # This is the port our Node.js app will listen on EXPOSE 3000 # Define the command to run your app using CMD which defines your runtime CMD [ "node", "server.js" ]