FROM node:18-slim # Create app directory WORKDIR /app # Install dependencies first to leverage Docker cache COPY package.json package-lock.json ./ RUN npm ci # Copy the rest of the source code COPY . . # Build project from source RUN npm run build # Expose the port used by the dev server (BrowserSync) EXPOSE 3000 # Start the app (builds again if needed, but should be fast after first run) CMD ["npm", "start"]