Skip to content

Commit

Permalink
ci: try layer caching again on benchmark
Browse files Browse the repository at this point in the history
  • Loading branch information
mickamy committed Jan 8, 2024
1 parent 0472c4e commit db68fcf
Showing 1 changed file with 44 additions and 3 deletions.
47 changes: 44 additions & 3 deletions .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ jobs:
ISHOCON_APP_LANG: ${{ matrix.language }}
UNAME: ${{ secrets.DOCKER_HUB_USERNAME }}
steps:
- run: echo "DATE=$(date +%Y%m%d)" >> $GITHUB_ENV
- uses: actions/checkout@v4
- name: Replace base image in docker-compose.yml with github actor name
run: |
Expand All @@ -40,10 +41,50 @@ jobs:
with:
username: ${{ env.UNAME }}
password: ${{ secrets.DOCKER_HUB_TOKEN }}
- name: Build images
- name: Cache docker layers
uses: actions/cache@v3
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Build bench image
uses: docker/build-push-action@v5
with:
context: .
file: ./docker/benchmarker/Dockerfile
tags: ${{ env.UNAME }}/ishocon2-bench:latest,${{ env.UNAME }}/ishocon2-bench:${{ env.DATE }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max
- name: Build base image
uses: docker/build-push-action@v5
with:
context: .
file: ./docker/app/base/Dockerfile
tags: ${{ env.UNAME }}/ishocon2-app-base:latest,${{ env.UNAME }}/ishocon2-app-base:${{ env.DATE }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max
- name: Build app image
uses: docker/build-push-action@v5
with:
context: .
push: true
file: ./docker/app/${{ env.ISHOCON_APP_LANG }}/Dockerfile
tags: ${{ env.UNAME }}/ishocon2-app-${{ env.ISHOCON_APP_LANG }}:latest,${{ env.UNAME }}/ishocon2-app-${{ env.ISHOCON_APP_LANG }}:${{ env.DATE }}
build-args: BASE_IMAGE=${{ env.UNAME }}/ishocon2-app-base:latest
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max
- name: Move new cache to the place where to be cached
run: |
make pull || true
make build
echo "Temporary fix for cleaning up old cache."
echo "See isssues:
- https://github.com/docker/build-push-action/issues/252
- https://github.com/moby/buildkit/issues/1896
"
rm -rf /tmp/.buildx-cache
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
- name: Build images
run: make build
timeout-minutes: 20
- run: make up bench-with-db-init
timeout-minutes: 10
Expand Down

0 comments on commit db68fcf

Please sign in to comment.