From 0e8ab36baf4df8edafc6947477d3d024877df737 Mon Sep 17 00:00:00 2001 From: Navin Peiris Date: Wed, 9 Oct 2024 11:05:14 +0530 Subject: [PATCH 1/2] Support for depot.dev builders --- README.md | 37 +++++++++++++++++++++++- lib/kamal/commands/builder.rb | 10 +++++-- lib/kamal/commands/builder/depot.rb | 22 ++++++++++++++ lib/kamal/configuration/builder.rb | 4 +++ lib/kamal/configuration/docs/builder.yml | 6 ++++ 5 files changed, 76 insertions(+), 3 deletions(-) create mode 100644 lib/kamal/commands/builder/depot.rb diff --git a/README.md b/README.md index 924e1e278..f8b82d8e7 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,39 @@ -# Kamal: Deploy web apps anywhere +# Kamal with support for depot.dev builders + +This is an actively maintained fork of [basecamp/kamal](https://github.com/basecamp/kamal) that's kept in sync with support for [depot.dev](https://depot.dev) builders. + +``` +The main branch is currently in sync with version 2.10.1 +``` + +## Installation with depot builder support + +Run the following commands to use `kamal` from this repository: + +```sh +gem install specific_install && gem specific_install https://github.com/navinpeiris/kamal-depot.git +``` + +## Building with depot builders + +Set the `depot` option under `builder` to `true`, and optionally specify the platforms to build for under `arch`. + +```yaml +builder: + depot: true + arch: + - amd64 + - arm64 +``` + +## Rebasing with basecamp/kamal + +```sh +git fetch upstream +git rebase vX.X.X +``` + +## Kamal: Deploy web apps anywhere From bare metal to cloud VMs, deploy web apps anywhere with zero downtime. Kamal uses [kamal-proxy](https://github.com/basecamp/kamal-proxy) to seamlessly switch requests between containers. Works seamlessly across multiple servers, using SSHKit to execute commands. Originally built for Rails apps, Kamal will work with any type of web app that can be containerized with Docker. diff --git a/lib/kamal/commands/builder.rb b/lib/kamal/commands/builder.rb index 0b6cdda4b..12e1c5f34 100644 --- a/lib/kamal/commands/builder.rb +++ b/lib/kamal/commands/builder.rb @@ -7,7 +7,7 @@ class Kamal::Commands::Builder < Kamal::Commands::Base to: :target delegate \ - :local?, :remote?, :pack?, :cloud?, + :local?, :remote?, :pack?, :cloud?, :depot?, to: "config.builder" include Clone @@ -17,7 +17,9 @@ def name end def target - if remote? + if depot? + depot + elsif remote? if local? hybrid else @@ -32,6 +34,10 @@ def target end end + def depot + @depot ||= Kamal::Commands::Builder::Depot.new(config) + end + def remote @remote ||= Kamal::Commands::Builder::Remote.new(config) end diff --git a/lib/kamal/commands/builder/depot.rb b/lib/kamal/commands/builder/depot.rb new file mode 100644 index 000000000..220dfa851 --- /dev/null +++ b/lib/kamal/commands/builder/depot.rb @@ -0,0 +1,22 @@ +class Kamal::Commands::Builder::Depot < Kamal::Commands::Builder::Base + def push(export_action = "registry", tag_as_dirty: false, no_cache: false) + depot :build, + "--push", + "--output=type=#{export_action}", + *platform_options(arches), + *build_tag_options(tag_as_dirty: tag_as_dirty), + *build_options, + *([ "--no-cache" ] if no_cache), + build_context, + "2>&1" + end + + def inspect_builder + # No-op + end + + private + def depot(*args) + args.compact.unshift :depot + end +end diff --git a/lib/kamal/configuration/builder.rb b/lib/kamal/configuration/builder.rb index 0e2c4c618..a11bca1ab 100644 --- a/lib/kamal/configuration/builder.rb +++ b/lib/kamal/configuration/builder.rb @@ -45,6 +45,10 @@ def remote_arches end end + def depot? + builder_config["depot"] == true + end + def remote? remote_arches.any? end diff --git a/lib/kamal/configuration/docs/builder.yml b/lib/kamal/configuration/docs/builder.yml index 190fd240a..e4e6360c1 100644 --- a/lib/kamal/configuration/docs/builder.yml +++ b/lib/kamal/configuration/docs/builder.yml @@ -8,6 +8,12 @@ # # Options go under the builder key in the root configuration. builder: + # Use depot.dev for builds + # + # If true, Kamal will use depot.dev for builds. + # + # Defaults to false: + depot: false # Arch # From 57ced5db5d00da94197fde2d08b06d4174ad8ab5 Mon Sep 17 00:00:00 2001 From: Bob Forma <1178544+bforma@users.noreply.github.com> Date: Tue, 20 Jan 2026 14:00:04 +0100 Subject: [PATCH 2/2] Remove redundant --push --- lib/kamal/commands/builder/depot.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/kamal/commands/builder/depot.rb b/lib/kamal/commands/builder/depot.rb index 220dfa851..417797a93 100644 --- a/lib/kamal/commands/builder/depot.rb +++ b/lib/kamal/commands/builder/depot.rb @@ -1,7 +1,6 @@ class Kamal::Commands::Builder::Depot < Kamal::Commands::Builder::Base def push(export_action = "registry", tag_as_dirty: false, no_cache: false) depot :build, - "--push", "--output=type=#{export_action}", *platform_options(arches), *build_tag_options(tag_as_dirty: tag_as_dirty),