Skip to content

Commit

Permalink
Avoid additional container dependencies when using container alias names
Browse files Browse the repository at this point in the history
Fixes issue build#751

with such lines in Dockerfile:

FROM opensuse/leap:15.3 as base
FROM base AS build
  • Loading branch information
adrianschroeter committed Jan 10, 2022
1 parent 5a7a35b commit ebbec6f
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Build/Docker.pm
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@ sub parse {
my $excludedline;
my $vars = {};
my $vars_env = {};
my %as_container;

my @requiredarch;
my @badarch;
Expand Down Expand Up @@ -282,6 +283,8 @@ sub parse {
if ($cmd eq 'FROM') {
shift @args if @args && $args[0] =~ /^--platform=/;
if (@args) {
next if $as_container{$args[0]};
$as_container{$args[2]} = $args[0] if @args > 2 && lc($args[1]) eq 'as';
my $container = $args[0];
if ($container ne 'scratch') {
$container .= ':latest' unless $container =~ /:[^:\/]+$/;
Expand Down

0 comments on commit ebbec6f

Please sign in to comment.