Skip to content

Commit ed1bcad

Browse files
authored
Separate docker build & docker push steps (#211)
* Separete docker build & docker push steps * Remove :push kwarg from Controlplane#image_build
1 parent c595899 commit ed1bcad

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

lib/command/build_image.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,11 @@ def call # rubocop:disable Metrics/MethodLength
3838
docker_args: config.args,
3939
build_args: build_args)
4040

41-
progress.puts("\nPushed image to '/org/#{config.org}/image/#{image_name}'.\n\n")
41+
push_path = "/org/#{config.org}/image/#{image_name}"
42+
43+
progress.puts("\nPushing image to '#{push_path}'...\n\n")
44+
cp.image_push(image_url)
45+
progress.puts("\nPushed image to '#{push_path}'.\n\n")
4246

4347
step("Waiting for image to be available", retry_on_failure: true) do
4448
images = cp.query_images["items"]

lib/core/controlplane.rb

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ def query_images(a_gvc = gvc, a_org = org, partial_gvc_match: nil)
9090
api.query_images(org: a_org, gvc: a_gvc, gvc_op_type: gvc_op)
9191
end
9292

93-
def image_build(image, dockerfile:, docker_args: [], build_args: [], push: true)
93+
def image_build(image, dockerfile:, docker_args: [], build_args: [])
9494
# https://docs.controlplane.com/guides/push-image#step-2
9595
# Might need to use `docker buildx build` if compatiblitity issues arise
9696
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)
9999
cmd += " #{docker_args.join(' ')}" if docker_args.any?
100100
build_args.each { |build_arg| cmd += " --build-arg #{build_arg}" }
101101
cmd += " #{config.app_dir}"
102-
perform!(cmd)
103102

104-
image_push(image) if push
103+
perform!(cmd)
105104
end
106105

107106
def fetch_image_details(image)

0 commit comments

Comments
 (0)