Expand description
Runtime templates for ZLayer builder
This module provides pre-built Dockerfile templates for common runtimes, allowing users to build container images without writing Dockerfiles.
§Usage
Templates can be used via the zlayer build command:
# Use a specific runtime template
zlayer build --runtime node20
# Auto-detect runtime from project files
zlayer build --detect-runtime§Available Runtimes
- Node.js 20 (
node20): Production-ready Node.js 20 with Alpine base - Node.js 22 (
node22): Production-ready Node.js 22 with Alpine base - Python 3.12 (
python312): Python 3.12 slim with pip packages - Python 3.13 (
python313): Python 3.13 slim with pip packages - Rust (
rust): Static binary build with musl - Go (
go): Static binary build with Alpine - Deno (
deno): Official Deno runtime - Bun (
bun): Official Bun runtime
§Auto-Detection
The detect_runtime function can automatically detect the appropriate
runtime based on files present in the project directory:
package.json-> Node.js (unless Bun or Deno indicators present)bun.lockb-> Bundeno.jsonordeno.jsonc-> DenoCargo.toml-> Rustrequirements.txt,pyproject.toml,setup.py-> Pythongo.mod-> Go
Structs§
- Runtime
Info - Information about a runtime template
Enums§
- Runtime
- Supported runtime environments
Functions§
- detect_
runtime - Detect the runtime from files in the given directory.
- detect_
runtime_ with_ version - Detect runtime with version hints from project files.
- get_
template - Get template content for a runtime
- get_
template_ by_ name - Get template content by runtime name
- list_
templates - List all available templates
- resolve_
runtime - Resolve runtime from either explicit name or auto-detection