Skip to content

Commit

Permalink
docker buildx cache local
Browse files Browse the repository at this point in the history
  • Loading branch information
steebchen committed Sep 3, 2024
1 parent d5d7b08 commit eacb3d1
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
11 changes: 9 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,16 @@ jobs:
test:
runs-on: ubuntu-latest-32-core
steps:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- uses: actions/checkout@v4
- uses: asdf-vm/actions/install@v3
- name: Build
run: cargo build --verbose
- name: Run tests
run: ./scripts/e2e_test.sh
- # Temp fix
# https://github.com/docker/build-push-action/issues/252
# https://github.com/moby/buildkit/issues/1896
name: Move cache
run: |
rm -rf /tmp/.buildx-cache
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
12 changes: 10 additions & 2 deletions scripts/e2e_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,20 @@
set -eux
IMAGE_NAME="http-prover-test"
# Check if the image already exists
docker build -t $IMAGE_NAME .

if docker images | grep -q "$IMAGE_NAME"; then
echo "Image $IMAGE_NAME already exists. Skipping build step."
else
echo "Image $IMAGE_NAME does not exist. Building the image..."
docker build -t $IMAGE_NAME .

if [ "${CI:-}" == "true" ]; then
docker buildx build -t $IMAGE_NAME . \
--cache-from type=local,src=/tmp/.buildx-cache \
--cache-to type=local,dest=/tmp/.buildx-cache-new,mode=max
else
docker build -t $IMAGE_NAME .
fi

if [ $? -ne 0 ]; then
echo "Failed to build the image. Exiting."
exit 1
Expand Down

0 comments on commit eacb3d1

Please sign in to comment.