From 8c17b1ebc6b234537ca016e7e4a58bfd9a6441ba Mon Sep 17 00:00:00 2001 From: Nick Hammond Date: Fri, 7 Feb 2025 13:07:33 -0700 Subject: [PATCH] Add export_action support for pack --- lib/kamal/commands/builder/pack.rb | 33 ++++++++++++++++++++---------- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/lib/kamal/commands/builder/pack.rb b/lib/kamal/commands/builder/pack.rb index 672051b4..9a6007ab 100644 --- a/lib/kamal/commands/builder/pack.rb +++ b/lib/kamal/commands/builder/pack.rb @@ -1,6 +1,19 @@ class Kamal::Commands::Builder::Pack < Kamal::Commands::Builder::Base - def push + def push(export_action = "registry") combine \ + build, + export(export_action) + end + + def remove;end + + def info + pack :builder, :inspect, pack_builder + end + alias_method :inspect_builder, :info + + private + def build pack(:build, config.repository, "--platform", platform, @@ -12,19 +25,17 @@ class Kamal::Commands::Builder::Pack < Kamal::Commands::Builder::Base "--env", "BP_IMAGE_LABELS=service=#{config.service}", *argumentize("--env", args), *argumentize("--env", secrets, sensitive: true), - "--path", build_context), - docker(:push, config.absolute_image), - docker(:push, config.latest_image) - end + "--path", build_context) + end - def remove;end + def export(export_action) + return unless export_action == "registry" - def info - pack :builder, :inspect, pack_builder - end - alias_method :inspect_builder, :info + combine \ + docker(:push, config.absolute_image), + docker(:push, config.latest_image) + end - private def platform "linux/#{local_arches.first}" end