# Step 1: Use an official Node.js runtime as a parent image FROM node:latest # Step 2: Set the working directory in the container WORKDIR /usr/src/app # Step 3: Copy package.json and package-lock.json (or yarn.lock) COPY package*.json ./ # Step 4: Install dependencies RUN npm install # Step 5: Copy the rest of your app's source code COPY . . # Step 6: Build the app RUN npm run build # Step 7: Install serve and serve the production build RUN npm install -g serve CMD ["serve", "-s", "build"]