How to deploy on Dokku?

We recommend to read Dokku documentation for the setup and Deploying a Node.js Application on Digital Ocean using Dokku.

For the example, we will call our Nuxt.js application my-nuxt-app.

We need to tell Dokku to install the devDependencies of the project (to be able to launch npm run build):

// on Dokku Server
dokku config:set my-nuxt-app NPM_CONFIG_PRODUCTION=false

Also, we want our application to listen on the port and run in production mode:

// on Dokku Server
dokku config:set my-nuxt-app HOST= NODE_ENV=production

You should see these 3 lines when you type dokku config my-nuxt-app

nuxt config vars Dokku

Then, we tell Dokku to launch npm run build via the scripts.dokku.predeploy script in our project app.json:

create a file name app.json in our project root folder

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

Finally, we can push our app on Dokku with:

// commit your change before push.
git remote add dokku dokku@yourServer:my-nuxt-app
git push dokku master

VoilĂ ! Our Nuxt.js application is now hosted on Dokku!

Caught a mistake or want to contribute to the documentation? Edit this page on GitHub!