A Cloud Native Buildpack for Deno applications that automatically detects and builds Deno projects with proper dependency caching and multi-architecture support.
- 🚀 Automatic Detection: Detects Deno applications based on configuration files and TypeScript entry points
- 📦 Smart Caching: Three-layer caching system for runtime, dependencies, and application code
- 🏗️ Multi-Architecture: Supports both AMD64 and ARM64 architectures
- 🔧 Version Management: Supports
.deno-versionfiles and external version configuration - 🌐 Network Resilience: Robust download handling with retry logic and comprehensive error messages
- ⚡ Fast Rebuilds: Efficient layer invalidation and restoration for quick subsequent builds
# Build your Deno app using this buildpack
pack build my-deno-app --buildpack julianduque/deno-cnb
# Run the built image
docker run --rm -p 8080:8080 my-deno-appThe buildpack automatically detects Deno applications that have any of the following:
deno.jsonordeno.jsoncconfiguration files- TypeScript entry points:
main.ts,mod.ts,app.ts, orindex.ts deno.locklock file.deno-versionversion specification file
my-deno-app/
├── deno.json # Deno configuration
├── .deno-version # Optional: specify Deno version
├── main.ts # Application entry point
└── deps.ts # Optional: dependency management
The buildpack supports multiple ways to specify the Deno version:
-
.deno-versionfile (recommended):2.3.1 -
Default version: Falls back to the latest stable version defined in the buildpack's inventory
Your Deno application should define a start task in deno.json:
{
"tasks": {
"start": "deno run --allow-net --allow-read main.ts"
}
}The buildpack will execute deno run start to launch your application.
The buildpack uses a three-layer caching strategy:
-
Runtime Layer (
deno-runtime): Contains the Deno binary- Cached based on Deno version and architecture
- Shared across builds with the same Deno version
-
Dependencies Layer (
deno-dependencies): Contains cached dependencies- Invalidated when
deno.lockordeno.json/deno.jsoncchanges - Significantly speeds up builds with unchanged dependencies
- Invalidated when
-
Application Layer (
deno-app): Contains your application code- Rebuilt on every build to capture code changes
- Lightweight since dependencies are cached separately
# Package the buildpack
cargo libcnb package
# The packaged buildpack will be available in the packaged/ directoryThe project includes comprehensive test fixtures:
# Run all tests
cd test-fixtures
./run-tests.sh
# Test specific fixture
./run-tests.sh basic-web-server- basic-web-server: Simple HTTP server using native Deno APIs
- with-dependencies: Tests external dependency resolution
- complex-config: Complex
deno.jsoncconfiguration - with-version-file: Tests
.deno-versionfile handling - minimal-app: Bare minimum setup
- AMD64 (x86_64): Fully supported
- ARM64 (aarch64): Fully supported
The buildpack automatically detects the target architecture and downloads the appropriate Deno binary.
The buildpack provides comprehensive error messages and troubleshooting guidance for common issues:
- Network connectivity problems
- Invalid Deno versions
- Missing or corrupted downloads
- Configuration file issues
- Dependency resolution failures
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests for new functionality
- Run the test suite
- Submit a pull request
# Clone the repository
git clone https://github.com/julianduque/deno-cnb.git
cd deno-cnb
# Build the buildpack
cargo libcnb package
# Run tests
cd test-fixtures
./run-tests.shThis project is licensed under the Apache License 2.0 - see the LICENSE file for details.
- Deno - The secure runtime for JavaScript and TypeScript
- Cloud Native Buildpacks - The specification and ecosystem
- libcnb.rs - The Rust framework for buildpacks
Built with 💜 for the Heroku, Deno and Cloud Native communities.