|
8 | 8 | # Daily |
9 | 9 | - cron: '0 0 * * *' |
10 | 10 |
|
| 11 | +env: |
| 12 | + DOCKERHUB_REPO: frolvlad/alpine-glibc |
| 13 | + |
11 | 14 | jobs: |
12 | 15 | build: |
13 | 16 | strategy: |
|
20 | 23 | os: ubuntu-24.04-arm |
21 | 24 | runs-on: ${{ matrix.os }} |
22 | 25 | steps: |
| 26 | + - name: Prepare |
| 27 | + run: | |
| 28 | + platform=${{ matrix.platform }} |
| 29 | + echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV |
| 30 | +
|
| 31 | + - name: Docker meta |
| 32 | + id: meta |
| 33 | + uses: docker/metadata-action@v5 |
| 34 | + with: |
| 35 | + images: | |
| 36 | + ${{ env.DOCKERHUB_REPO }} |
| 37 | +
|
23 | 38 | - name: Login to Docker Hub |
24 | 39 | uses: docker/login-action@v3 |
25 | 40 | with: |
|
34 | 49 | uses: docker/build-push-action@v6 |
35 | 50 | with: |
36 | 51 | platforms: ${{ matrix.platform }} |
37 | | - pull: true |
38 | | - push: true |
39 | | - tags: frolvlad/alpine-glibc:latest,frolvlad/alpine-glibc:alpine-3.21_glibc-2.41,frolvlad/alpine-glibc:alpine-3_glibc-2.41,frolvlad/alpine-glibc:alpine-3.21,frolvlad/alpine-glibc:alpine-3,frolvlad/alpine-glibc:glibc-2.41 |
40 | | - cache-from: type=registry,ref=frolvlad/alpine-glibc:latest |
41 | | - cache-to: type=inline |
| 52 | + labels: ${{ steps.meta.outputs.labels }} |
| 53 | + outputs: type=image,"name=${{ env.DOCKERHUB_REPO }}",push-by-digest=true,name-canonical=true,push=true |
| 54 | + |
| 55 | + - name: Export digest |
| 56 | + run: | |
| 57 | + mkdir -p ${{ runner.temp }}/digests |
| 58 | + digest="${{ steps.build.outputs.digest }}" |
| 59 | + touch "${{ runner.temp }}/digests/${digest#sha256:}" |
| 60 | +
|
| 61 | + - name: Upload digest |
| 62 | + uses: actions/upload-artifact@v4 |
| 63 | + with: |
| 64 | + name: digests-${{ env.PLATFORM_PAIR }} |
| 65 | + path: ${{ runner.temp }}/digests/* |
| 66 | + if-no-files-found: error |
| 67 | + retention-days: 1 |
| 68 | + |
| 69 | + merge: |
| 70 | + runs-on: ubuntu-latest |
| 71 | + needs: |
| 72 | + - build |
| 73 | + steps: |
| 74 | + - name: Download digests |
| 75 | + uses: actions/download-artifact@v4 |
| 76 | + with: |
| 77 | + path: ${{ runner.temp }}/digests |
| 78 | + pattern: digests-* |
| 79 | + merge-multiple: true |
| 80 | + |
| 81 | + - name: Login to Docker Hub |
| 82 | + uses: docker/login-action@v3 |
| 83 | + with: |
| 84 | + username: ${{ secrets.DOCKERHUB_USERNAME }} |
| 85 | + password: ${{ secrets.DOCKERHUB_TOKEN }} |
| 86 | + |
| 87 | + - name: Set up Docker Buildx |
| 88 | + uses: docker/setup-buildx-action@v3 |
| 89 | + |
| 90 | + - name: Docker meta |
| 91 | + id: meta |
| 92 | + uses: docker/metadata-action@v5 |
| 93 | + with: |
| 94 | + images: | |
| 95 | + ${{ env.DOCKERHUB_REPO }} |
| 96 | + tags: | |
| 97 | + type=ref,event=branch |
| 98 | + type=ref,event=pr |
| 99 | + type=semver,pattern={{version}} |
| 100 | + type=semver,pattern={{major}}.{{minor}} |
| 101 | +
|
| 102 | + - name: Create manifest list and push |
| 103 | + working-directory: ${{ runner.temp }}/digests |
| 104 | + run: | |
| 105 | + docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \ |
| 106 | + $(printf '${{ env.DOCKERHUB_REPO }}@sha256:%s ' *) |
| 107 | +
|
| 108 | + - name: Inspect image |
| 109 | + run: | |
| 110 | + docker buildx imagetools inspect ${{ env.DOCKERHUB_REPO }}:${{ steps.meta.outputs.version }} |
0 commit comments