with latest tag
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
Kasper Juul Hermansen 2022-08-21 00:17:57 +02:00
parent 16cf5d8fe4
commit 1dbf1eb537
Signed by: kjuulh
GPG Key ID: 0F95C140730F2F23
2 changed files with 38 additions and 4 deletions

View File

@ -2,8 +2,9 @@
set -e
tag="$REGISTRY/$SERVICE:${COMMIT_SHA:0:10}"
latest_tag="$REGISTRY/$SERVICE:latest"
base_tag=$REGISTRY/$SERVICE
tag="$base_tag:${COMMIT_SHA:0:10}"
latest_tag="$base_tag:latest"
if [[ -n $DEBUG ]]
then
@ -17,6 +18,25 @@ fi
echo "docker: logging in"
docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD
DOCKER_BUILDKIT=1 docker build -t "$tag" --build-arg BUILDKIT_INLINE_CACHE=1 --cache-from $latest_tag -f "$TMP/build_release.Dockerfile" .
export DOCKER_BUILDKIT=1
function build_target {
target=$1
echo "building $target"
target_tag="$base_tag-$target:${COMMIT_SHA:0:10}"
latest_target_tag="$base_tag-$target:latest"
docker build \
--target "$target" \
--tag "$target_tag" \
--build-arg BUILDKIT_INLINE_CACHE=1 \
--cache-from $latest_tag \
--file "$TMP/build_release.Dockerfile" .
docker tag "$target_tag" "$latest_target_tag"
}
build_target "deps"
build_target "builder"
docker build -t "$tag" --build-arg BUILDKIT_INLINE_CACHE=1 --cache-from $latest_tag -f "$TMP/build_release.Dockerfile" .
docker tag "$tag" "$latest_tag"

View File

@ -3,6 +3,7 @@
set -e
tag="$REGISTRY/$SERVICE:${COMMIT_SHA:0:10}"
latest_tag="$REGISTRY/$SERVICE:latest"
if [[ -n $DEBUG ]]
then
@ -16,5 +17,18 @@ 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_BUILDKIT=1 docker push "$tag"
docker push "$tag"
docker push "$latest_tag"