Complete the code to specify the base image for the build stage.
FROM [1] AS builderThe node:18-alpine image is a lightweight base suitable for building Node.js applications in the builder stage.
Complete the code to copy source files into the builder stage.
COPY [1] /appThe dot . means copying all files from the current directory into the /app directory inside the container.
Fix the error in the final stage to copy only the built files from the builder stage.
COPY --from=[1] /app/dist /app
The --from=builder flag copies files from the stage named builder, which contains the built application.
Fill both blanks to define the final image and set the working directory.
FROM [1] WORKDIR [2]
The final image uses node:18-alpine for a lightweight runtime, and the working directory is set to /usr/src/app where the app files are copied.
Fill all three blanks to complete the multi-stage Dockerfile snippet for building and running a microservice.
FROM [1] AS builder COPY [2] /src RUN npm install && npm run build FROM [3] COPY --from=builder /src/dist /app CMD ["node", "/app/index.js"]
The builder stage uses node:18-alpine for building. The source files are copied from the current directory .. The final stage uses node:18-slim for a smaller runtime image.