Coding task · Next.js course · Module 8: Deployment and Production

Practice: Create a Dockerfile for a Next.js Application

Create a Dockerfile

Task

Create a Dockerfile for a Next.js app with a multi-stage build: install the dependencies and build the app in a stage based on a node image, copy only the build output into the final stage (COPY --from), set NODE_ENV=production, run the app as a non-root user (USER) and start it with CMD.