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..417797a93 --- /dev/null +++ b/lib/kamal/commands/builder/depot.rb @@ -0,0 +1,21 @@ +class Kamal::Commands::Builder::Depot < Kamal::Commands::Builder::Base + def push(export_action = "registry", tag_as_dirty: false, no_cache: false) + depot :build, + "--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 #