# Use an official Node runtime as a parent image FROM node:21-alpine # Set the working directory in the container to /app WORKDIR /app # Copy package.json and package-lock.json before other files # Utilise Docker cache to save re-installing dependencies if unchanged COPY package*.json ./ # Install dependencies RUN npm install # Copy all files COPY . . # Build the app RUN npm run build # Serve the app on port 3000 EXPOSE 3000 CMD ["npm", "start"]