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 <sebastian.schuberth@bosch.io>
  • Loading branch information
sschuberth committed May 4, 2023
1 parent 21c8737 commit a858ae0
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: Setup Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- 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 a858ae0

Please sign in to comment.