Update README.md #71
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: container-images | |
| on: | |
| push: | |
| branches: [ "main", "feature/**" ] | |
| tags: [ "v*" ] | |
| jobs: | |
| build-and-push-matrix: | |
| name: Build & Push Matrix | |
| runs-on: ${{ matrix.runner }} | |
| permissions: | |
| contents: read | |
| packages: write | |
| id-token: write | |
| env: | |
| USE_DOCKER_HUB: true | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - platform: linux/amd64 | |
| runner: ubuntu-24.04 | |
| - platform: linux/arm64 | |
| runner: ubuntu-24.04-arm | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - uses: docker/setup-qemu-action@v3 | |
| - uses: docker/setup-buildx-action@v3 | |
| - run: echo "IMAGE_TAG=dev" >> $GITHUB_ENV | |
| if: github.ref_name == 'main' || startsWith(github.ref_name, 'feature/') | |
| - run: echo "IMAGE_TAG=${GITHUB_REF##*/}" >> $GITHUB_ENV | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| - name: Login to ghcr.io | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Login to docker.io | |
| if: ${{ env.USE_DOCKER_HUB == 'true' }} | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ secrets.DOCKER_HUB_UID }} | |
| password: ${{ secrets.DOCKER_HUB_PAT }} | |
| - name: Build standard image | |
| run: | | |
| TAGS="--tag ghcr.io/${{ github.repository }}:${{ env.IMAGE_TAG }}" | |
| if [ "${USE_DOCKER_HUB}" = "true" ]; then | |
| TAGS="$TAGS --tag ${{ secrets.DOCKER_HUB_REPO }}:${{ env.IMAGE_TAG }}" | |
| fi | |
| docker buildx build \ | |
| --platform ${{ matrix.platform }} \ | |
| $TAGS \ | |
| --file ./Dockerfile \ | |
| --output type=image,push=true \ | |
| . | |
| - name: Build distroless image | |
| run: | | |
| TAGS="--tag ghcr.io/${{ github.repository }}:${{ env.IMAGE_TAG }}" | |
| if [ "${USE_DOCKER_HUB}" = "true" ]; then | |
| TAGS="$TAGS --tag ${{ secrets.DOCKER_HUB_REPO }}:${{ env.IMAGE_TAG }}" | |
| fi | |
| docker buildx build \ | |
| --platform ${{ matrix.platform }} \ | |
| $TAGS \ | |
| --file ./Dockerfile.dless \ | |
| --output type=image,push=true \ | |
| . |