This is an example of how to set up a Node.js application with a Dockerfile to deploy on Kinsta’s Application Hosting services.

  1. Fork this GitHub repository: Kinsta – Hello World – Dockerfile – Node.js
  2. In MyKinsta, add an application with the Hello World – Dockerfile – Node.js repository. Make sure you select Use Dockerfile to set up a container image.
  3. The Start command can be left blank for the web process as Kinsta automatically detects the required command during the first deployment.

The app is available as soon as the build finishes and a Hello World page loads at your application’s URL.

Node.js with Dockerfile Hello World page after successful installation.
Node.js with Dockerfile Hello World page after successful installation.

Deployment Lifecycle

When you create the app, Kinsta creates a process from the CMD instruction.
CMD ["npm", "run", "start"]

If you change this command in the repository, the process is not changed by default, so you must edit the process on your application’s Processes page in MyKinsta.