FROM node:18-alpine AS builder # Set working directory WORKDIR /app # Copy package.json and install dependencies COPY package.json package-lock.json ./ RUN npm ci # Copy the rest of the app and build COPY . . RUN npm run build # Stage 2: Minimal image for exporting build artifacts FROM alpine:latest # Set working directory for output WORKDIR /output # Copy the built files from the builder stage COPY --from=builder /app/build . # No CMD because this image is just used to extract build files