Dockerize a next.js project for deployment.
Steps taken to build a docker image.
-
Change the next.js configuration file to make the project a standalone app.
module.exports = { output: 'standalone', // ... }
-
Build the docker image.
npm run docker-build
-
Run the app as a container.
npm run docker-up
-
Navigate to http://localhost:3000.