Skip to content

Commit

Permalink
Add Docker cache for interop image build
Browse files Browse the repository at this point in the history
  • Loading branch information
kentbull committed Dec 8, 2023
1 parent a27c747 commit 05fcfa6
Showing 1 changed file with 22 additions and 6 deletions.
28 changes: 22 additions & 6 deletions .github/workflows/python-app-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
os: [ macos-latest, ubuntu-latest ]

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python 3.10.4
uses: actions/setup-python@v2
with:
Expand All @@ -46,7 +46,7 @@ jobs:
coverage:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python 3.10.4
uses: actions/setup-python@v2
with:
Expand All @@ -67,7 +67,7 @@ jobs:
scripts:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python 3.10.4
uses: actions/setup-python@v2
with:
Expand All @@ -89,7 +89,7 @@ jobs:
GITHUB_REPOSITORY_NAME: ${{ steps.cache.outputs.GITHUB_REPOSITORY_NAME }}
steps:
- name: Git checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Set outputs
id: cache
run: |
Expand All @@ -106,12 +106,28 @@ jobs:
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
steps:
- name: Git checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Set up Docker buildx
id: buildx
uses: docker/setup-buildx-action@v3

- name: Cache Docker Layers
uses: actions/cache@v3
with:
path: /tmp/.buildx-cache
key: keri-${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
keri-${{ runner.os }}-buildx-
- name: interop
run: |
echo ${{ secrets.CR_PAT }} | docker login ghcr.io --username ${{ secrets.CR_USER }} --password-stdin
docker build -f .github/workflows/interop/Dockerfile --no-cache -t ${{ env.GITHUB_REPOSITORY_NAME }}/keripy-interop:${{ env.CACHE_KEY_INTEROP }} .
docker buildx build --platform linux/amd64 --cache-from type=local,src=/tmp/.buildx-cache --cache-to type=local,dest=/tmp/.buildx-cache-new,mode=max -f .github/workflows/interop/Dockerfile -t ${{ env.GITHUB_REPOSITORY_NAME }}/keripy-interop:${{ env.CACHE_KEY_INTEROP }} .
docker tag ${{ env.GITHUB_REPOSITORY_NAME }}/keripy-interop:${{ env.CACHE_KEY_INTEROP }} ghcr.io/${{ env.GITHUB_REPOSITORY_NAME }}/keripy-interop:latest
docker push ghcr.io/${{ env.GITHUB_REPOSITORY_NAME }}/keripy-interop:latest
mkdir -p ${GITHUB_WORKSPACE}/cache
touch ${GITHUB_WORKSPACE}/cache/${{ env.CACHE_KEY_INTEROP }}
- name: Move Docker cache
run: |
rm -rf /tmp/.buildx-cache
mv /tmp/.buildx-cache-new /tmp/.buildx-cache

0 comments on commit 05fcfa6

Please sign in to comment.