Add GIT_COMMIT build arg to ensure cache invalidation between different commits on the same branch

This commit is contained in:
wotnak 2023-12-21 12:47:53 +01:00
parent 778de46e31
commit e54d689376
No known key found for this signature in database
GPG Key ID: B00835978B0C9B6B
2 changed files with 6 additions and 0 deletions

View File

@ -46,6 +46,7 @@ jobs:
build-args: |
FARMOS_REPO=https://github.com/${{ env.FARMOS_REPO }}
FARMOS_VERSION=${{ env.FARMOS_VERSION }}
GIT_COMMIT=${{ github.sha }}
tags: farmos/farmos:3.x
cache-from: type=gha,scope=prod
cache-to: type=gha,scope=prod
@ -67,6 +68,7 @@ jobs:
build-args: |
FARMOS_REPO=https://github.com/${{ env.FARMOS_REPO }}
FARMOS_VERSION=${{ env.FARMOS_VERSION }}
GIT_COMMIT=${{ github.sha }}
tags: farmos/farmos:3.x-dev
cache-from: |
type=gha,scope=prod

View File

@ -55,6 +55,10 @@ RUN build-farmOS.sh
# Create layer with farmOS sources.
FROM composer-file as farmos-sources
# Declare the git commit hash argument used for build cache invalidation between
# different commits on the same branch in GitHub actions.
ARG GIT_COMMIT=unknown
# Install sources.
RUN composer install --no-dev