diff --git a/scripts/build-container b/scripts/build-container index 122d469..c457661 100755 --- a/scripts/build-container +++ b/scripts/build-container @@ -36,20 +36,27 @@ chomp($git_commit_sha); # -- my main build system is DRONE, so I'm using DRONE variables a lot # --------------------------------------------------------------------------- my $container_registry = $ENV{'CONTAINER_REGISTRY'} || 'git.badhouseplants.net'; -my $image_name = $ENV{'DRONE_REPO'} || "badhouseplants/badhouseplants-net"; +my $image_name = $ENV{"PACKAGE_NAME"} | $ENV{'DRONE_REPO'} || "badhouseplants/badhouseplants-net"; my $tag = "$container_registry/$image_name:$git_commit_sha"; +my $custom_tag = $ENV{"CUSTOM_TAG"} || ""; my $username = $ENV{'DRONE_USERNAME'} || "allanger"; my $password = $ENV{'GITEA_TOKEN'} || "YOU NOT AUTHORIZED, PAL"; +my $containerfile = $ENV{'CONTAINERFILE'} || "."; 0 == system ("buildah login --username $username --password $password $container_registry") or die $!; -0 == system ("buildah build -t $tag .") or die $!; +0 == system ("buildah bud -t $tag $containerfile") or die $!; 0 == system ("buildah push $tag") or die $!; # --------------------------------------------------------------------------- # -- Push the latest if the branch is main # --------------------------------------------------------------------------- if ( $git_branch eq $main_branch) { my $latest_tag = "$container_registry/$image_name:latest"; - 0 == system ("buildah tag $tag $latest_tag") or die $!; + 0 == system ("buildah tag $tag $latest_tag") or die $!; 0 == system ("buildah push $latest_tag") or die $!; } +if ( $custom_tag ne "" ) { + my $custom_tag_final = "$container_registry/$image_name:$custom_tag"; + 0 == system ("buildah tag $tag $custom_tag_final") or die $!; + 0 == system ("buildah push $custom_tag_final") or die $!; +} print "Thanks!\n";