Complete the Dockerfile to specify the base image for a Next.js app.
FROM [1]The base image node:18-alpine is a lightweight Node.js image suitable for Next.js apps.
Complete the Dockerfile command to copy package.json and package-lock.json files.
COPY [1] ./Using package*.json copies both package.json and package-lock.json files needed for installing dependencies.
Fix the error in the Dockerfile command to install dependencies.
RUN npm [1]The npm install command installs all dependencies listed in package.json.
Fill both blanks to expose the correct port and set the command to start the Next.js app.
EXPOSE [1] CMD ["npm", "[2]"]
Next.js apps by default run on port 3000, and npm start runs the production server.
Fill all three blanks to create a Docker Compose service for the Next.js app with build context, port mapping, and environment variable.
services:
web:
build: [1]
ports:
- "[2]:3000"
environment:
- NODE_ENV=[3]The build context is the current directory ".", port 3000 is mapped, and NODE_ENV is set to production for deployment.