Skip to content

Commit 2348a6e

Browse files
committed
Add multi-platform support
1 parent 8f2a0bd commit 2348a6e

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

bin/build_all.pl

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
use Mojo::File qw/path/;
99

1010
GetOptions(
11+
'builder' => \my $builder,
12+
'push' => \my $push,
1113
'no_cache|no-cache' => \my $no_cache,
1214
'workers=i' => \my $workers,
1315
'errored|errored_only|errored-only' => \my $errored_only,
@@ -29,6 +31,8 @@
2931
);
3032
my %aliases_rev;
3133

34+
my %use_builder = map {$_ => 1} qw( noble plucky questing );
35+
3236
while (my ($alias, $name) = each %aliases) {
3337
$aliases_rev{$name} ||= [];
3438
push @{ $aliases_rev{$name} }, $alias;
@@ -49,7 +53,11 @@
4953
my $dockerfile = path("$name/Dockerfile")->slurp;
5054
my ($from) = $dockerfile =~ /^FROM (\S+)/;
5155
system("docker pull $from");
52-
system("docker build $name $tags" . ($no_cache ? " --no-cache" : "") . " 2>&1 | tee log/build_$name.log");
56+
if ($builder && $use_builder{$name}) {
57+
system("docker buildx build --builder $builder --platform linux/amd64,linux/arm64 $name $tags --output=type=image" . ($no_cache ? " --no-cache" : "") . ($push ? " --push" : "") . " 2>&1 | tee log/build_$name.log");
58+
} else {
59+
system("docker build $name $tags" . ($no_cache ? " --no-cache" : "") . " 2>&1 | tee log/build_$name.log");
60+
}
5361
my $log = path("log/build_$name.log")->slurp;
5462
if ($log =~ m!(naming to docker.io/movabletype/test:$name (\S+ )?done|Successfully built)!) {
5563
if ($log =~ /No package (.+) available/) {

0 commit comments

Comments
 (0)