Complete the Dockerfile line to set the base image for development.
FROM [1]The development Dockerfile often uses a lightweight Node.js image like node:18-alpine for faster builds and smaller size.
Complete the command to copy source code into the container in the development Dockerfile.
COPY [1] /appIn development, we copy the src/ folder to have the latest source code inside the container.
Fix the error in the production Dockerfile line that installs dependencies.
RUN npm [1] --productionnpm run or npm start instead of install.The correct command to install dependencies is npm install --production to install only production packages.
Fill both blanks to set the working directory and expose the port in the production Dockerfile.
WORKDIR [1] EXPOSE [2]
Production Dockerfiles often use /usr/src/app as the working directory and expose port 3000 for the app.
Fill all three blanks to create a multi-stage production Dockerfile that builds and runs the app.
FROM node:18-alpine AS builder WORKDIR [1] COPY package.json . RUN npm install COPY . . RUN npm run build FROM node:18-alpine WORKDIR [2] COPY --from=builder [1]/[3] ./ CMD ["node", "dist/index.js"]
The builder and final stages use /usr/src/app as working directory. The built files are in dist folder copied from builder.