Add export_action support for pack

This commit is contained in:
Nick Hammond
2025-02-07 13:07:33 -07:00
parent f8f7c6ec57
commit 8c17b1ebc6

View File

@@ -1,6 +1,19 @@
class Kamal::Commands::Builder::Pack < Kamal::Commands::Builder::Base class Kamal::Commands::Builder::Pack < Kamal::Commands::Builder::Base
def push def push(export_action = "registry")
combine \ 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, pack(:build,
config.repository, config.repository,
"--platform", platform, "--platform", platform,
@@ -12,19 +25,17 @@ class Kamal::Commands::Builder::Pack < Kamal::Commands::Builder::Base
"--env", "BP_IMAGE_LABELS=service=#{config.service}", "--env", "BP_IMAGE_LABELS=service=#{config.service}",
*argumentize("--env", args), *argumentize("--env", args),
*argumentize("--env", secrets, sensitive: true), *argumentize("--env", secrets, sensitive: true),
"--path", build_context), "--path", build_context)
docker(:push, config.absolute_image), end
docker(:push, config.latest_image)
end
def remove;end def export(export_action)
return unless export_action == "registry"
def info combine \
pack :builder, :inspect, pack_builder docker(:push, config.absolute_image),
end docker(:push, config.latest_image)
alias_method :inspect_builder, :info end
private
def platform def platform
"linux/#{local_arches.first}" "linux/#{local_arches.first}"
end end