I've been a long-time fan of Dokku. It's how I host most of my side projects on cheap Digital Ocean droplets.
Recently, I created an Online Invoice Generator for which I needed to generate PDF invoices. For the PDF generation, I use Puppeteer and hosting Puppeteer anywhere is always a bit tricky, since you basically need an environment that can install and run Chromium.
Here's how I got Puppeteer running on Dokku:
Dockerfile for Puppeteer on Dokku
Thanks to Dokku's support for Dockerfiles, you can deploy almost anything on Dokku.
Here's the Dockerfile I used to deploy my Node.js app with Puppeteer on Dokku:
DOCKERFILE
# Use an official Node.js runtime as a parent imageFROM node:18# Install puppeteer dependenciesRUN apt-get update && apt-get install -y \gconf-service \libasound2 \libatk1.0-0 \libc6 \libcairo2 \libcups2 \libdbus-1-3 \libexpat1 \libfontconfig1 \libgcc1 \libgconf-2-4 \libgdk-pixbuf2.0-0 \libglib2.0-0 \libgtk-3-0 \libnspr4 \libpango-1.0-0 \libpangocairo-1.0-0 \libstdc++6 \libx11-6 \libx11-xcb1 \libxcb1 \libxcomposite1 \libxcursor1 \libxdamage1 \libxext6 \libxfixes3 \libxi6 \libxrandr2 \libxrender1 \libxss1 \libxtst6 \ca-certificates \fonts-liberation \libappindicator1 \libnss3 \lsb-release \xdg-utils \wgetWORKDIR /app# Copy over the project filesCOPY . .# Install dependenciesRUN npm install# Run the app when the container launchesCMD ["node", "src/server/server.js"]
This Dockerfile is based on the official Node.js image and installs all the dependencies required by Puppeteer.
After adding that to your app's repository, you just need to configure your app on your Dokku server to use the Dockerfile deployment and you're good to go!