#!/bin/bash set -e base_tag="$REGISTRY/$SERVICE" tag="$base_tag:${COMMIT_SHA:0:10}" latest_tag="$base_tag:latest" if [[ -n $DEBUG ]] then echo "debug:" echo " REGISTRY: $REGISTRY" echo " SERVICE: $SERVICE" echo " COMMIT_SHA: $COMMIT_SHA" echo " TMP: $TMP" fi echo "docker: logging in" docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD export DOCKER_BUILDKIT=1 function build_target { target=$1 echo "building $target" latest_target_tag="$base_tag-$target:latest" docker push "$latest_target_tag" } build_target "deps" build_target "builder" echo "docker: pushing image $tag" docker push "$tag" docker push "$latest_tag"