Skip to content

Commit

Permalink
ci: use docker/bake-action.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
ericonr committed Nov 30, 2023
1 parent c07047c commit 3257980
Showing 1 changed file with 6 additions and 14 deletions.
20 changes: 6 additions & 14 deletions .github/workflows/base-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 3257980

Please sign in to comment.