Add more explicit cache image name
This commit is contained in:
parent
3e75fcc0e4
commit
8c336b4dec
8 changed files with 38 additions and 14 deletions
11
.github/workflows/build.yml
vendored
11
.github/workflows/build.yml
vendored
|
@ -78,7 +78,11 @@ jobs:
|
||||||
cache-to: type=registry,mode=max,ref=${{ steps.imagename.outputs.name }}:cache
|
cache-to: type=registry,mode=max,ref=${{ steps.imagename.outputs.name }}:cache
|
||||||
cache-from: type=registry,ref=${{ steps.imagename.outputs.name }}:cache
|
cache-from: type=registry,ref=${{ steps.imagename.outputs.name }}:cache
|
||||||
- name: Generate download cache Dockerfile
|
- name: Generate download cache Dockerfile
|
||||||
run: ./generate.sh dl only
|
id: dl_cache
|
||||||
|
run: |
|
||||||
|
./generate.sh dl only
|
||||||
|
echo "dltagname=$(./util/get_dl_cache_tag.sh)" >> $GITHUB_OUTPUT
|
||||||
|
cat Dockerfile.dl
|
||||||
- name: Build download cache image
|
- name: Build download cache image
|
||||||
uses: docker/build-push-action@v3
|
uses: docker/build-push-action@v3
|
||||||
with:
|
with:
|
||||||
|
@ -86,7 +90,7 @@ jobs:
|
||||||
file: Dockerfile.dl
|
file: Dockerfile.dl
|
||||||
pull: true
|
pull: true
|
||||||
push: true
|
push: true
|
||||||
tags: ${{ steps.imagename.outputs.dlname }}:latest
|
tags: ${{ steps.imagename.outputs.dlname }}:${{ steps.dl_cache.outputs.dltagname }}
|
||||||
cache-to: type=registry,mode=max,ref=${{ steps.imagename.outputs.dlname }}:cache
|
cache-to: type=registry,mode=max,ref=${{ steps.imagename.outputs.dlname }}:cache
|
||||||
cache-from: type=registry,ref=${{ steps.imagename.outputs.dlname }}:cache
|
cache-from: type=registry,ref=${{ steps.imagename.outputs.dlname }}:cache
|
||||||
- name: Cleanup
|
- name: Cleanup
|
||||||
|
@ -110,7 +114,8 @@ jobs:
|
||||||
repository_owner: ${{ github.repository_owner }}
|
repository_owner: ${{ github.repository_owner }}
|
||||||
repository: ${{ github.repository }}
|
repository: ${{ github.repository }}
|
||||||
owner_type: user
|
owner_type: user
|
||||||
untagged_only: true
|
untagged_only: false
|
||||||
|
keep_latest: 3
|
||||||
build_target_bases:
|
build_target_bases:
|
||||||
name: Build target base image
|
name: Build target base image
|
||||||
if: ${{ github.event.inputs.buildOnly != 'true' }}
|
if: ${{ github.event.inputs.buildOnly != 'true' }}
|
||||||
|
|
|
@ -69,6 +69,8 @@ if [[ "$TARGET" == "dl" && "$VARIANT" == "only" ]]; then
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
DL_IMAGE="${DL_IMAGE_RAW}:$(./util/get_dl_cache_tag.sh)"
|
||||||
|
|
||||||
###
|
###
|
||||||
### Generate main Dockerfile
|
### Generate main Dockerfile
|
||||||
###
|
###
|
||||||
|
@ -78,7 +80,10 @@ exec_dockerstage() {
|
||||||
(
|
(
|
||||||
SELF="$SCRIPT"
|
SELF="$SCRIPT"
|
||||||
source "$SCRIPT"
|
source "$SCRIPT"
|
||||||
|
|
||||||
ffbuild_enabled || exit 0
|
ffbuild_enabled || exit 0
|
||||||
|
|
||||||
|
to_df "ENV SELF=\"$SELF\""
|
||||||
ffbuild_dockerstage || exit $?
|
ffbuild_dockerstage || exit $?
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
17
makeimage.sh
17
makeimage.sh
|
@ -43,11 +43,20 @@ if [[ -z "$QUICKBUILD" ]]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
./generate.sh "$TARGET" "$VARIANT" "${ADDINS[@]}"
|
./generate.sh "$TARGET" "$VARIANT" "${ADDINS[@]}"
|
||||||
|
DL_CACHE_TAG="$(./util/get_dl_cache_tag.sh)"
|
||||||
|
DL_IMAGE="${DL_IMAGE_RAW}:${DL_CACHE_TAG}"
|
||||||
|
|
||||||
docker buildx --builder ffbuilder build -f Dockerfile.dl \
|
if docker pull "${DL_IMAGE}"; then
|
||||||
--cache-from=type=local,src=.cache/"${DL_IMAGE/:/_}" \
|
export REGISTRY_OVERRIDE_DL="$REGISTRY" GITHUB_REPOSITORY_DL="$REPO"
|
||||||
--cache-to=type=local,mode=max,dest=.cache/"${DL_IMAGE/:/_}" \
|
./generate.sh "$TARGET" "$VARIANT" "${ADDINS[@]}"
|
||||||
--push --tag "${LOCAL_ROOT}/dl_cache:latest" .
|
else
|
||||||
|
DL_IMAGE="${LOCAL_ROOT}/dl_cache:${DL_CACHE_TAG}"
|
||||||
|
docker manifest inspect --insecure "${DL_IMAGE}" >/dev/null ||
|
||||||
|
docker buildx --builder ffbuilder build -f Dockerfile.dl \
|
||||||
|
--cache-from=type=local,src=.cache/dl_image_cache \
|
||||||
|
--cache-to=type=local,mode=max,dest=.cache/dl_image_cache \
|
||||||
|
--push --tag "${DL_IMAGE}" .
|
||||||
|
fi
|
||||||
|
|
||||||
docker buildx --builder ffbuilder build \
|
docker buildx --builder ffbuilder build \
|
||||||
--cache-from=type=local,src=.cache/"${IMAGE/:/_}" \
|
--cache-from=type=local,src=.cache/"${IMAGE/:/_}" \
|
||||||
|
|
|
@ -8,7 +8,7 @@ ffbuild_enabled() {
|
||||||
}
|
}
|
||||||
|
|
||||||
ffbuild_dockerstage() {
|
ffbuild_dockerstage() {
|
||||||
to_df "RUN --mount=src=${SELF},dst=/stage.sh --mount=src=\$FFBUILD_DLDIR,dst=\$FFBUILD_DLDIR,from=${DL_IMAGE},rw --mount=src=patches/aom,dst=/patches SELF=\"$SELF\" run_stage /stage.sh"
|
to_df "RUN --mount=src=${SELF},dst=/stage.sh --mount=src=\$FFBUILD_DLDIR,dst=\$FFBUILD_DLDIR,from=${DL_IMAGE},rw --mount=src=patches/aom,dst=/patches run_stage /stage.sh"
|
||||||
}
|
}
|
||||||
|
|
||||||
ffbuild_dockerbuild() {
|
ffbuild_dockerbuild() {
|
||||||
|
|
|
@ -8,7 +8,7 @@ ffbuild_enabled() {
|
||||||
}
|
}
|
||||||
|
|
||||||
ffbuild_dockerstage() {
|
ffbuild_dockerstage() {
|
||||||
to_df "RUN --mount=src=${SELF},dst=/stage.sh --mount=src=\$FFBUILD_DLDIR,dst=\$FFBUILD_DLDIR,from=${DL_IMAGE},rw --mount=src=patches/aribb24,dst=/patches SELF=\"$SELF\" run_stage /stage.sh"
|
to_df "RUN --mount=src=${SELF},dst=/stage.sh --mount=src=\$FFBUILD_DLDIR,dst=\$FFBUILD_DLDIR,from=${DL_IMAGE},rw --mount=src=patches/aribb24,dst=/patches run_stage /stage.sh"
|
||||||
}
|
}
|
||||||
|
|
||||||
ffbuild_dockerbuild() {
|
ffbuild_dockerbuild() {
|
||||||
|
|
|
@ -8,7 +8,7 @@ ffbuild_enabled() {
|
||||||
}
|
}
|
||||||
|
|
||||||
ffbuild_dockerstage() {
|
ffbuild_dockerstage() {
|
||||||
to_df "RUN --mount=src=${SELF},dst=/stage.sh --mount=src=\$FFBUILD_DLDIR,dst=\$FFBUILD_DLDIR,from=${DL_IMAGE},rw --mount=src=patches/zvbi,dst=/patches SELF=\"$SELF\" run_stage /stage.sh"
|
to_df "RUN --mount=src=${SELF},dst=/stage.sh --mount=src=\$FFBUILD_DLDIR,dst=\$FFBUILD_DLDIR,from=${DL_IMAGE},rw --mount=src=patches/zvbi,dst=/patches run_stage /stage.sh"
|
||||||
}
|
}
|
||||||
|
|
||||||
ffbuild_dockerdl() {
|
ffbuild_dockerdl() {
|
||||||
|
|
4
util/get_dl_cache_tag.sh
Executable file
4
util/get_dl_cache_tag.sh
Executable file
|
@ -0,0 +1,4 @@
|
||||||
|
#!/bin/bash
|
||||||
|
set -eo pipefail
|
||||||
|
printf dlcache_
|
||||||
|
tail -n+3 Dockerfile.dl | sha256sum | cut -d' ' -f1
|
|
@ -36,12 +36,13 @@ REGISTRY="${REGISTRY_OVERRIDE:-ghcr.io}"
|
||||||
BASE_IMAGE="${REGISTRY}/${REPO}/base:latest"
|
BASE_IMAGE="${REGISTRY}/${REPO}/base:latest"
|
||||||
TARGET_IMAGE="${REGISTRY}/${REPO}/base-${TARGET}:latest"
|
TARGET_IMAGE="${REGISTRY}/${REPO}/base-${TARGET}:latest"
|
||||||
IMAGE="${REGISTRY}/${REPO}/${TARGET}-${VARIANT}${ADDINS_STR:+-}${ADDINS_STR}:latest"
|
IMAGE="${REGISTRY}/${REPO}/${TARGET}-${VARIANT}${ADDINS_STR:+-}${ADDINS_STR}:latest"
|
||||||
DL_IMAGE="${REGISTRY}/${REPO}/dl_cache:latest"
|
|
||||||
|
|
||||||
|
DL_IMAGE_RAW="${REGISTRY}/${REPO}/dl_cache"
|
||||||
if [[ -n "$REGISTRY_OVERRIDE_DL" && -n "$GITHUB_REPOSITORY_DL" ]]; then
|
if [[ -n "$REGISTRY_OVERRIDE_DL" && -n "$GITHUB_REPOSITORY_DL" ]]; then
|
||||||
DL_IMAGE="${REGISTRY_OVERRIDE_DL}/${GITHUB_REPOSITORY_DL}/dl_cache:latest"
|
DL_IMAGE_RAW="${REGISTRY_OVERRIDE_DL}/${GITHUB_REPOSITORY_DL}/dl_cache"
|
||||||
DL_IMAGE="${DL_IMAGE,,}"
|
DL_IMAGE_RAW="${DL_IMAGE_RAW,,}"
|
||||||
fi
|
fi
|
||||||
|
DL_IMAGE="${DL_IMAGE_RAW}:unset"
|
||||||
|
|
||||||
ffbuild_dockerdl() {
|
ffbuild_dockerdl() {
|
||||||
default_dl "$SELF"
|
default_dl "$SELF"
|
||||||
|
@ -52,7 +53,7 @@ ffbuild_dockerlayer_dl() {
|
||||||
}
|
}
|
||||||
|
|
||||||
ffbuild_dockerstage() {
|
ffbuild_dockerstage() {
|
||||||
to_df "RUN --mount=src=${SELF},dst=/stage.sh --mount=src=\$FFBUILD_DLDIR,dst=\$FFBUILD_DLDIR,from=${DL_IMAGE},rw SELF=\"$SELF\" run_stage /stage.sh"
|
to_df "RUN --mount=src=${SELF},dst=/stage.sh --mount=src=\$FFBUILD_DLDIR,dst=\$FFBUILD_DLDIR,from=${DL_IMAGE},rw run_stage /stage.sh"
|
||||||
}
|
}
|
||||||
|
|
||||||
ffbuild_dockerlayer() {
|
ffbuild_dockerlayer() {
|
||||||
|
|
Loading…
Reference in a new issue