Skip to content

Puppeteer example that works on GKE Autopilot (Google Kubernetes Engine) with Software-Rendering (no GPU needed)

License

Notifications You must be signed in to change notification settings

Doorbit/puppeteer-docker-three.js-gke

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Three.js canvas rendering with Puppeteer on GKE Autopilot without GPU

Puppeteer example with GKE Autopilot (Google Kubernetes Engine), software-rendering a Three.js canvas. GPU on GKE is quite expensive and quite complex to set up. This example shows how to use Puppeteer to render a Three.js canvas without GPU, by enabling software-rendering mode on the Linux machine.

Usage

Try local first?

You need node.js and npm installed locally.

npm install puppeteer
node test.js

This will goto this Three.js example, wait 2 seconds to load the canvas and then take a screenshot my_screenshot.png and store it in the current directory.

Screenshot Output

Docker

Clean up node_modules, package.json and package-lock.json in case you have run the local example before.

docker build -t puppeteer-docker-three.js-gke .
docker run puppeteer-docker-three.js-gke

The screenshot will be stored in /app/my_screenshot.png inside the container.

GKE Autopilot

The dockerimage is compatible with GKE Autopilot. There is no SYS_ADMIN needed, as you don't use hardware acceleration with this image.

Use the kubectl cp to download the screenshot from the GCP POD.

About

Puppeteer example that works on GKE Autopilot (Google Kubernetes Engine) with Software-Rendering (no GPU needed)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published