Jannik's Blog

A Dockerfile to Run Playwright on Digital Ocean App Platform

I’ve been a fan of Digital Ocean for a couple of years now, and recently, I wanted to explore their fully managed Application Platform offering, which is similar to Heroku.

Deploying a simple Node.js API was as easy as linking my GitHub Project Repo and letting the Application Platform handle the configuration and deployment automatically.

However, I encountered problems when I wanted to deploy a project running the browser automation framework, Playwright. Playwright has some dependencies, mostly related to installing browser components (Chromium, in my case), which require root access. Unfortunately, this is not possible on the Digital Ocean Application Platform.

Since I did not want to deploy and manage a full-blown VPS, or “Droplet” as Digital Ocean calls them, I looked for ways to make Playwright run anyway. Fortunately, I found a threat by someone having a similar issue related to Puppeteer, which is very similar to Playwright. So, I was confident that the App Platform was capable of running Playwright as well.

The solution

Here is the script I used to deploy my Playwright Node app to Digital Ocean’s App Platform. Bear in mind that I have not tested the script in a production environment, but I hope it can help you get your project up and running more quickly.

This post helped me get up to speed with the Docker basics.

I you have any suggestions or run into problems: Let’s chat here