cuddle-rust-plan/scripts/build_release.sh
2022-08-21 16:45:28 +02:00

23 lines
517 B
Bash
Executable File

#!/bin/bash
echo "building docker image"
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
docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD
docker pull "$latest_tag"
DOCKER_BUILDKIT=1 docker build --cache-from "$latest_tag" -t "$tag" -f "$TMP/build_release.Dockerfile" .
docker tag "$tag" "$latest_tag"