From 325798053f026245e6b4c9d987c4343fa79bb8ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89rico=20Nogueira?= Date: Thu, 30 Nov 2023 17:09:39 -0300 Subject: [PATCH] ci: use docker/bake-action. This allows us to avoid writing our own commands for things, and works with GHA cache for images, which speeds up CI and avoids unnecessary resource usage. --- .github/workflows/base-image.yml | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/.github/workflows/base-image.yml b/.github/workflows/base-image.yml index 4ea3fc4..e2aa21a 100644 --- a/.github/workflows/base-image.yml +++ b/.github/workflows/base-image.yml @@ -25,17 +25,9 @@ jobs: IMAGE: ${{ matrix.image.name }} SOURCE: https://github.com/${{ github.repository }} steps: - - uses: actions/checkout@v3 - - name: Build image - run: cd ${{ matrix.image.dir }} && JOBS=$(nproc) docker compose build - - name: Log in to registry - if: github.event_name == 'push' && vars.PUSH_TO_REGISTRY == 'true' - run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin - - name: Push tagged image - if: github.event_name == 'push' && vars.PUSH_TO_REGISTRY == 'true' && github.ref_type == 'tag' - run: docker push $REGISTRY/$IMAGE:$TAG - - name: Push latest image - if: github.event_name == 'push' && vars.PUSH_TO_REGISTRY == 'true' && github.ref_type == 'branch' - run: | - docker tag $REGISTRY/$IMAGE:$TAG $REGISTRY/$IMAGE:latest - docker push $REGISTRY/$IMAGE:latest + - uses: actions/checkout@v4 + - uses: docker/setup-buildx-action@v3 + - uses: docker/bake-action@v4 + with: + workdir: ${{ matrix.image.dir }} + files: docker-compose.yml