Skip to content

Commit

Permalink
build(github): Enable Docker image caching between workflows
Browse files Browse the repository at this point in the history
For details see [1].

[1]: https://docs.docker.com/build/ci/github-actions/cache/#github-cache

Signed-off-by: Sebastian Schuberth <[email protected]>
  • Loading branch information
sschuberth committed May 4, 2023
1 parent 21c8737 commit 977ceae
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,33 @@ jobs:
java-version: 17
- name: Restore Gradle cache entries
uses: gradle/gradle-build-action@v2
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Build and push the Docker image
uses: docker/build-push-action@v4
with:
build-args: USER_ID=1001
context: .
cache-from: type=registry,ref=ort:buildcache
cache-to: type=registry,ref=ort:buildcache,mode=max
push: true
tags: ort:pr
- name: Build and load the Docker image
uses: docker/build-push-action@v4
with:
build-args: USER_ID=1001
context: .
cache-from: type=registry,ref=ort:buildcache
cache-to: type=registry,ref=ort:buildcache,mode=max
load: true
- name: Build Docker image manually
run: DOCKER_BUILDKIT=1 docker build --build-arg USER_ID=1001 .
- name: Validate Batect wrapper scripts
uses: batect/batect-wrapper-validation-action@v0
- name: Run functional tests that do require external tools
Expand Down

0 comments on commit 977ceae

Please sign in to comment.