Jan 20th 2019How 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:

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

2. Tell Dokku how to start the app:

web: npm start -- --port $PORT

That's it! :)