Skip to content

Commit

Permalink
Use separate tags for architectures
Browse files Browse the repository at this point in the history
  • Loading branch information
TheAssassin committed Jan 2, 2025
1 parent f6b4dd4 commit fdb05b2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
13 changes: 10 additions & 3 deletions ci/build-docker-image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,13 @@ fi

image=ghcr.io/theassassin/appimagelauncher-build
branch="$(git rev-parse --abbrev-ref HEAD)"
# append platform to Docker image tag since we can't push separate (multi-arch) images to the same name without
# creating the manifest manually
# see https://github.com/docker/build-push-action/issues/671
platform_suffix="$(echo -n "$DOCKER_PLATFORM" | tr -c 'A-Za-z0-9-' '_')"

current_branch_tag="${image}:${branch}_${platform_suffix}"
master_branch_tag="${image}:master_${platform_suffix}"

docker_command=(
docker buildx build
Expand All @@ -36,10 +43,10 @@ docker_command=(
--build-arg DOCKER_PLATFORM="$DOCKER_PLATFORM"

# cache from the current branch's image
--cache-from type=registry,ref="$image:$branch"
--cache-from type=registry,ref="$current_branch_tag"

# we can always cache from the master branch's image
--cache-from type=registry,ref="$image:master"
--cache-from type=registry,ref="$master_branch_tag"

--tag "$image:$branch"
)
Expand All @@ -49,7 +56,7 @@ if [[ "${GITHUB_ACTIONS:-}" != "" ]]; then
echo "Going to push built image"
docker_command+=(
--cache-to type=inline
--output type=registry,ref="$image:$branch"
--push
)
fi

Expand Down
2 changes: 1 addition & 1 deletion ci/build-in-docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,6 @@ uid="$(id -u)"
# run build
docker run -e DIST -e ARCH -e GITHUB_RUN_NUMBER -e GITHUB_RUN_ID --rm -i --user "$uid" -w /ws -e CI=1 \
"${DOCKER_OPTS[@]}" -v "$(readlink -f ..):/ws" \
"$image:$branch" \
"$current_branch_tag" \
bash ci/build.sh

0 comments on commit fdb05b2

Please sign in to comment.