Skip to content

Commit 570e445

Browse files
committed
Use multiple "-t" to avoid multiple docker build calls
1 parent c75035c commit 570e445

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

Rakefile

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,9 @@ def build_mri_images(platforms, host_platforms, output: )
1414
sdf = "tmp/docker/Dockerfile.mri.#{platform}"
1515
image_name = RakeCompilerDock::Starter.container_image_name(platform: platform)
1616

17-
RakeCompilerDock.docker_build(sdf, tag: image_name, platform: plats, output: output)
18-
19-
if image_name.include?("linux-gnu")
20-
RakeCompilerDock.docker_build(sdf, tag: image_name.sub("linux-gnu", "linux"), platform: plats, output: output)
21-
end
17+
tags = [image_name]
18+
tags << image_name.sub("linux-gnu", "linux") if image_name.include?("linux-gnu")
19+
RakeCompilerDock.docker_build(sdf, tag: tags, platform: plats, output: output)
2220
end
2321
end
2422

build/parallel_docker_build.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def docker_build_cmd(platform=nil)
2525
def docker_build(filename, tag: nil, output: false, platform: )
2626
cmd = docker_build_cmd(platform)
2727
return if cmd.nil?
28-
tag_args = ["-t", tag] if tag
28+
tag_args = Array(tag).flat_map{|t| ["-t", t] } if tag
2929
push_args = ["--push"] if output == 'push'
3030
push_args = ["--load"] if output == 'load'
3131
Class.new.extend(FileUtils).sh(*cmd, "-f", filename, ".", "--platform", platform, *tag_args, *push_args)

0 commit comments

Comments
 (0)