O'Reilly logo

Next.js Quick Start Guide by Kirill Konshin

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Creating a Docker container for Next.js

Let's reiterate: Docker is a virtual machine with an OS that is capable of managing containers. So, how to bring the container image to a required tools, libs and settings? Via an instruction file, of course, because this process has to be reproducible on a dev machine, in staging, in production, and anywhere else.

A Dockerfile is a set of instructions that take a source image and bring it to a desired state, which results in an image too. Any existing Dockerfile's outcome image could in turn be taken as a source for another one, and so on.

Let's start with a super-minimal set of packages:

$ npm i react react-dom isomorphic-unfetch --save$ npm i next --save-dev

Next, we create scripts in package.json ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required