Complete the code to specify the base image for an Astro Dockerfile.
FROM [1]The base image node:18-alpine is commonly used for Astro projects because Astro runs on Node.js.
Complete the Dockerfile command to copy project files into the container.
COPY [1] /appCopying . copies all project files from the current directory into the container's /app folder.
Fix the error in the Dockerfile command to install dependencies.
RUN npm [1]npm start which runs the app but does not install packages.npm build which is not a valid npm command.The command npm install installs all dependencies listed in package.json.
Fill both blanks to expose the correct port and set the default command.
EXPOSE [1] CMD ["npm", "[2]"]
npm build as the default command which only builds the app.Astro apps usually run on port 3000, so we expose port 3000. The default command npm start runs the app.
Fill all three blanks to create a multi-stage Dockerfile for building and serving an Astro app.
FROM node:18-alpine AS builder WORKDIR /app COPY [1] /app RUN npm install && npm run [2] FROM nginx:stable-alpine COPY --from=builder /app/[3] /usr/share/nginx/html
npm start instead of npm run build in the builder stage.First, copy the whole project . to build. Then run npm run build to create production files. Finally, copy the dist folder to Nginx to serve the static site.
