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-from: type=registry,ref=${{ steps.imagename.outputs.name }}:cache
|
||||
- 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
|
||||
uses: docker/build-push-action@v3
|
||||
with:
|
||||
|
@ -86,7 +90,7 @@ jobs:
|
|||
file: Dockerfile.dl
|
||||
pull: 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-from: type=registry,ref=${{ steps.imagename.outputs.dlname }}:cache
|
||||
- name: Cleanup
|
||||
|
@ -110,7 +114,8 @@ jobs:
|
|||
repository_owner: ${{ github.repository_owner }}
|
||||
repository: ${{ github.repository }}
|
||||
owner_type: user
|
||||
untagged_only: true
|
||||
untagged_only: false
|
||||
keep_latest: 3
|
||||
build_target_bases:
|
||||
name: Build target base image
|
||||
if: ${{ github.event.inputs.buildOnly != 'true' }}
|
||||
|
|
|
@ -69,6 +69,8 @@ if [[ "$TARGET" == "dl" && "$VARIANT" == "only" ]]; then
|
|||
exit 0
|
||||
fi
|
||||
|
||||
DL_IMAGE="${DL_IMAGE_RAW}:$(./util/get_dl_cache_tag.sh)"
|
||||
|
||||
###
|
||||
### Generate main Dockerfile
|
||||
###
|
||||
|
@ -78,7 +80,10 @@ exec_dockerstage() {
|
|||
(
|
||||
SELF="$SCRIPT"
|
||||
source "$SCRIPT"
|
||||
|
||||
ffbuild_enabled || exit 0
|
||||
|
||||
to_df "ENV SELF=\"$SELF\""
|
||||
ffbuild_dockerstage || exit $?
|
||||
)
|
||||
}
|
||||
|
|
17
makeimage.sh
17
makeimage.sh
|
@ -43,11 +43,20 @@ if [[ -z "$QUICKBUILD" ]]; then
|
|||
fi
|
||||
|
||||
./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 \
|
||||
--cache-from=type=local,src=.cache/"${DL_IMAGE/:/_}" \
|
||||
--cache-to=type=local,mode=max,dest=.cache/"${DL_IMAGE/:/_}" \
|
||||
--push --tag "${LOCAL_ROOT}/dl_cache:latest" .
|
||||
if docker pull "${DL_IMAGE}"; then
|
||||
export REGISTRY_OVERRIDE_DL="$REGISTRY" GITHUB_REPOSITORY_DL="$REPO"
|
||||
./generate.sh "$TARGET" "$VARIANT" "${ADDINS[@]}"
|
||||
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 \
|
||||
--cache-from=type=local,src=.cache/"${IMAGE/:/_}" \
|
||||
|
|
|
@ -8,7 +8,7 @@ ffbuild_enabled() {
|
|||
}
|
||||
|
||||
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() {
|
||||
|
|
|
@ -8,7 +8,7 @@ ffbuild_enabled() {
|
|||
}
|
||||
|
||||
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() {
|
||||
|
|
|
@ -8,7 +8,7 @@ ffbuild_enabled() {
|
|||
}
|
||||
|
||||
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() {
|
||||
|
|
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"
|
||||
TARGET_IMAGE="${REGISTRY}/${REPO}/base-${TARGET}: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
|
||||
DL_IMAGE="${REGISTRY_OVERRIDE_DL}/${GITHUB_REPOSITORY_DL}/dl_cache:latest"
|
||||
DL_IMAGE="${DL_IMAGE,,}"
|
||||
DL_IMAGE_RAW="${REGISTRY_OVERRIDE_DL}/${GITHUB_REPOSITORY_DL}/dl_cache"
|
||||
DL_IMAGE_RAW="${DL_IMAGE_RAW,,}"
|
||||
fi
|
||||
DL_IMAGE="${DL_IMAGE_RAW}:unset"
|
||||
|
||||
ffbuild_dockerdl() {
|
||||
default_dl "$SELF"
|
||||
|
@ -52,7 +53,7 @@ ffbuild_dockerlayer_dl() {
|
|||
}
|
||||
|
||||
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() {
|
||||
|
|
Loading…
Reference in a new issue