cuddle-rust-plan/scripts/build_release.sh

23 lines
517 B
Bash
Raw Normal View History

2022-08-10 22:54:58 +02:00
#!/bin/bash
echo "building docker image"
2022-08-21 16:42:38 +02:00
base_tag="$REGISTRY/$SERVICE"
tag="$base_tag:${COMMIT_SHA:0:10}"
latest_tag="$base_tag:latest"
2022-08-10 22:54:58 +02:00
if [[ -n $DEBUG ]]
then
echo "debug:"
echo " REGISTRY: $REGISTRY"
2022-08-11 01:24:26 +02:00
echo " SERVICE: $SERVICE"
echo " COMMIT_SHA: $COMMIT_SHA"
echo " TMP: $TMP"
2022-08-10 22:54:58 +02:00
fi
2022-08-21 16:42:38 +02:00
docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD
2022-08-21 16:45:28 +02:00
docker pull "$latest_tag"
2022-08-21 16:42:38 +02:00
DOCKER_BUILDKIT=1 docker build --cache-from "$latest_tag" -t "$tag" -f "$TMP/build_release.Dockerfile" .
2022-08-21 16:44:06 +02:00
docker tag "$tag" "$latest_tag"