mirror of
https://github.com/apricote/Listory.git
synced 2026-01-13 13:11:02 +00:00
fix: broken release pipeline on docker push
This commit is contained in:
parent
070d4996f4
commit
30e8cbf250
2 changed files with 30 additions and 18 deletions
28
hack/build-docker-image.sh
Executable file
28
hack/build-docker-image.sh
Executable file
|
|
@ -0,0 +1,28 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
set -o pipefail
|
||||
set -e
|
||||
|
||||
PREPARE_OR_PUBLISH="$1"
|
||||
VERSION="$2"
|
||||
|
||||
REPO="apricote/listory"
|
||||
|
||||
PLATFORMS="--platform=linux/amd64,linux/arm64"
|
||||
TAGS="--tag ${REPO}:${VERSION} --tag ${REPO}:latest"
|
||||
ARGS="--build-arg VERSION=${VERSION} --build-arg GIT_COMMIT=`git rev-parse HEAD`"
|
||||
|
||||
CACHE=""
|
||||
PUSH=""
|
||||
|
||||
# We "build" the image twice, once in "prepare" and then again in "publish" stage.
|
||||
# - Prepare makes sure that the image is buildable and utilizes the remote cache.
|
||||
# - Publish utilizes the local cache from prepare stage and pushes the image.
|
||||
if [ "$PREPARE_OR_PUBLISH" = "prepare" ]; then
|
||||
CACHE="--cache-from=type=registry,ref=${REPO}:buildcache --cache-to=type=registry,ref=${REPO}:buildcache"
|
||||
else
|
||||
# Uses local buildkit cache
|
||||
PUSH="--push"
|
||||
fi
|
||||
|
||||
docker buildx build $PLATFORMS $TAGS $ARGS $CACHE $PUSH .
|
||||
Loading…
Add table
Add a link
Reference in a new issue