Skip to content

Commit 634ada3

Browse files
committed
fixup! fixup! fixup! fixup! Cache Docker images on GitHub container registry
1 parent 5408b1f commit 634ada3

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

ci/build-in-docker.sh

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,23 @@ repo_root="$(readlink -f "$(dirname "$0")"/..)"
3434
# use docker image tag provided by GitHub actions if possible
3535
DOCKER_TAG="${DOCKER_TAG:-ghcr.io/appimage/appimageupdate-build:local-build}"
3636

37-
default_branch_tag="$(echo "$DOCKER_TAG" | cut -d: -f1):$(echo "$GITHUB_DEFAULT_BRANCH" | rev | cut -d/ -f1 | rev)"
37+
default_branch_tag="$(echo "$DOCKER_TAG" | cut -d: -f1):$(echo "${GITHUB_DEFAULT_BRANCH:-main}" | rev | cut -d/ -f1 | rev)"
38+
39+
extra_build_args=()
40+
41+
if [[ "${GITHUB_ACTIONS:-}" != "" ]]; then
42+
echo "Building on GitHub actions, pushing cache"
43+
extra_build_args+=(
44+
--output "type=registry,ref=${DOCKER_TAG}"
45+
--push
46+
)
47+
else
48+
echo "Local build, not pushing cache"
49+
fi
3850

3951
# building local image to "cache" installed dependencies for subsequent builds
40-
docker build \
41-
--cache-to inline \
52+
docker buildx build \
53+
"${extra_build_args[@]}" \
4254
--cache-from "type=registry,ref=${DOCKER_TAG}" \
4355
--cache-from "type=registry,ref=${default_branch_tag}" \
4456
--platform "$docker_platform" \

0 commit comments

Comments
 (0)