2022-08-20 23:50:57 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
2022-08-21 00:20:11 +02:00
|
|
|
base_tag="$REGISTRY/$SERVICE"
|
|
|
|
tag="$base_tag:${COMMIT_SHA:0:10}"
|
|
|
|
latest_tag="$base_tag:latest"
|
2022-08-20 23:50:57 +02:00
|
|
|
|
|
|
|
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
|
|
|
|
|
2022-08-21 00:17:57 +02:00
|
|
|
export DOCKER_BUILDKIT=1
|
|
|
|
|
2022-08-21 00:42:23 +02:00
|
|
|
function push_target {
|
2022-08-21 00:17:57 +02:00
|
|
|
target=$1
|
2022-08-21 00:42:23 +02:00
|
|
|
echo "pushing $target"
|
2022-08-21 00:17:57 +02:00
|
|
|
latest_target_tag="$base_tag-$target:latest"
|
|
|
|
docker push "$latest_target_tag"
|
|
|
|
}
|
|
|
|
|
2022-08-21 00:42:23 +02:00
|
|
|
function push_main_target {
|
|
|
|
echo "docker: pushing image $tag"
|
|
|
|
docker push "$tag"
|
|
|
|
docker push "$latest_tag"
|
|
|
|
}
|
|
|
|
|
|
|
|
push_target "deps" &
|
|
|
|
push_target "builder" &
|
|
|
|
push_main_target &
|
|
|
|
wait
|
2022-08-21 00:17:57 +02:00
|
|
|
|