Max SchmittMS
20th January 2019

How to deploy a Next.js app to Dokku

If you haven't already, create your Next.js app by following the procedure outlined in the Next.js docs.

To deploy a Next.js app to Dokku, you have to do two things:

1. Tell Dokku to build the app before running it:

app.json

{
"scripts": {
"dokku": {
"predeploy": "npm run build"
}
}
}

2. Tell Dokku how to start the app:

Procfile

web: npm start -- --port $PORT

That's it! :)

Image of my head

About the author

Hi, I’m Max! I'm a fullstack JavaScript developer living in Berlin.

When I’m not working on one of my personal projects, writing blog posts or making YouTube videos, I help my clients bring their ideas to life as a freelance web developer.

If you need help on a project, please reach out and let's work together.

To stay updated with new blog posts, follow me on Twitter or subscribe to my RSS feed.