diff --git a/lib/command/build_image.rb b/lib/command/build_image.rb index da7d12b9..6a75c509 100644 --- a/lib/command/build_image.rb +++ b/lib/command/build_image.rb @@ -38,7 +38,11 @@ def call # rubocop:disable Metrics/MethodLength docker_args: config.args, build_args: build_args) - progress.puts("\nPushed image to '/org/#{config.org}/image/#{image_name}'.\n\n") + push_path = "/org/#{config.org}/image/#{image_name}" + + progress.puts("\nPushing image to '#{push_path}'...\n\n") + cp.image_push(image_url) + progress.puts("\nPushed image to '#{push_path}'.\n\n") step("Waiting for image to be available", retry_on_failure: true) do images = cp.query_images["items"] diff --git a/lib/core/controlplane.rb b/lib/core/controlplane.rb index e69fa6c8..6f5137e1 100644 --- a/lib/core/controlplane.rb +++ b/lib/core/controlplane.rb @@ -90,7 +90,7 @@ def query_images(a_gvc = gvc, a_org = org, partial_gvc_match: nil) api.query_images(org: a_org, gvc: a_gvc, gvc_op_type: gvc_op) end - def image_build(image, dockerfile:, docker_args: [], build_args: [], push: true) + def image_build(image, dockerfile:, docker_args: [], build_args: []) # https://docs.controlplane.com/guides/push-image#step-2 # Might need to use `docker buildx build` if compatiblitity issues arise cmd = "docker build --platform=linux/amd64 -t #{image} -f #{dockerfile}" @@ -99,9 +99,8 @@ def image_build(image, dockerfile:, docker_args: [], build_args: [], push: true) cmd += " #{docker_args.join(' ')}" if docker_args.any? build_args.each { |build_arg| cmd += " --build-arg #{build_arg}" } cmd += " #{config.app_dir}" - perform!(cmd) - image_push(image) if push + perform!(cmd) end def fetch_image_details(image)