Skip to content

Commit

Permalink
ci: do not use docker build cache on CI
Browse files Browse the repository at this point in the history
  • Loading branch information
mickamy committed Jan 8, 2024
1 parent 1f05aeb commit 6ae0eaf
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 48 deletions.
53 changes: 5 additions & 48 deletions .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,61 +35,18 @@ jobs:
sed -i 's/ishocon2-bench/${{ env.UNAME }}\/ishocon2-bench/g' ./docker-compose.yml
sed -i 's/ishocon2-app-${{ env.ISHOCON_APP_LANG }}/${{ env.UNAME }}\/ishocon2-app-${{ env.ISHOCON_APP_LANG }}/g' ./docker-compose.yml
cat ./docker-compose.yml
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ env.UNAME }}
password: ${{ secrets.DOCKER_HUB_TOKEN }}
- name: Cache docker layers
uses: actions/cache@v3
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-${{ matrix.language }}-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-${{ matrix.language }}
${{ 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
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max
platforms: linux/amd64,linux/arm64/v8
- name: Build base image
uses: docker/build-push-action@v5
with:
context: .
file: ./docker/app/base/Dockerfile
tags: ${{ env.UNAME }}/ishocon2-app-base:latest,ishocon2-app-base:latest
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max
platforms: linux/amd64,linux/arm64/v8
- name: Build app image
uses: docker/build-push-action@v5
with:
context: .
file: ./docker/app/${{ env.ISHOCON_APP_LANG }}/Dockerfile
tags: ${{ env.UNAME }}/ishocon2-app-${{ env.ISHOCON_APP_LANG }}:latest
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max
platforms: linux/amd64,linux/arm64/v8
- name: Build images
run: |
make pull || true
build BASE_IMAGE=$${{ env.UNAME }}/ishocon2-app-base:latest
timeout-minutes: 20
- run: make up bench-with-db-init
timeout-minutes: 10
- name: Dump docker logs
uses: jwalton/gh-docker-logs@v2
if: ${{ always() }}
- name: Move new cache to the place where to be cached
run: |
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
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ build-bench:

build-app: change-lang build-base
ISHOCON_APP_LANG=$(ISHOCON_APP_LANG:python)
BASE_IMAGE ?= $(LOCAL_ISHOCON_BASE_IMAGE)
docker build \
-arg BASE_IMAGE=$(BASE_IMAGE) \
-f ./docker/app/$(ISHOCON_APP_LANG)/Dockerfile \
-t ishocon2-app-$(ISHOCON_APP_LANG):latest \
-t $(UNAME)/ishocon2-app-$(ISHOCON_APP_LANG):latest \
Expand Down

0 comments on commit 6ae0eaf

Please sign in to comment.