Skip to main content
Skip to main content
🚧 Work in Progress

Customise Deno runtime environment

Build Custom Runtime Images​

Zerops allows you to build custom runtime images (CRI) when the default base runtime images don't meet your Deno application's requirements. This is an optional phase in the build and deploy pipeline.

important

You should not include your application code in the custom runtime image, as your built/packaged code is deployed automatically into fresh containers.

Configuration​

Default Deno Runtime Environment​

The default Deno runtime environment contains:

  • Ubuntu 24.04
  • Selected version of Deno when the runtime service was created
  • zCLI
  • Deno and Git

When You Need a Custom Runtime Image​

If your Deno application needs more than what's included in the default environment, you'll need to build a custom runtime image. Common scenarios include:

  • System packages for processing: When your app processes images, videos, or files (requiring packages like sudo apt-get install -y imagemagick)
  • Global Deno tools: When you need CLI tools or utilities available system-wide
  • Native dependencies: When your Deno modules require system libraries that aren't in the default environment

Here are Deno-specific examples of configuring custom runtime images in your zerops.yml:

Basic Deno Setup​

run:
base: deno@2.0.0
prepareCommands:
- sudo apt-get update
- sudo apt-get install -y imagemagick
- deno install --allow-all --global some-tool

Using Build Files in Runtime Preparation​

build:
addToRunPrepare:
- deno.json
- import_map.json
run:
prepareCommands:
- sudo apt-get update
- sudo apt-get install -y imagemagick
- deno cache deps.ts

For complete configuration details, see the runtime prepare phase configuration guide.

Process and Caching​

How Runtime Prepare Works​

The runtime prepare process follows the same steps for all runtimes. See how runtime prepare works for the complete process details.

Caching Behavior​

Zerops caches custom runtime images to optimize deployment times. Learn about custom runtime image caching including when images are cached and reused.

Build Management​

For information about managing builds and deployments, see managing builds and deployments.

Warning

Shared storage mounts are not available during the runtime prepare phase.

Troubleshooting​

If your prepareCommands fail, check the prepare runtime log for specific error messages.