1616 permissions :
1717 # for docker/build-push-action to publish docker image
1818 packages : write
19-
2019 runs-on : ubuntu-latest
20+ strategy :
21+ matrix :
22+ dockerfile : [Dockerfile, Dockerfile.tools]
2123 steps :
2224 - name : Checkout code
2325 uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
@@ -56,38 +58,21 @@ jobs:
5658 uses : docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0
5759 with :
5860 context : .
61+ file : ${{ matrix.dockerfile }}
5962 build-args : |
6063 INSTALL_ALL=true
6164 platforms : linux/amd64,linux/arm64
6265 push : true
6366 tags : |
64- ${{ env.IMAGE_REPO }}:${{ env.IMAGE_TAG }}
65- ${{ env.IMAGE_REPO }}:latest
66- # Fix multi-platform: https://github.com/docker/buildx/issues/1533
67- provenance : false
68- secrets : |
69- "github_token=${{ secrets.GITHUB_TOKEN }}"
70-
71- - name : Build and Push tools release
72- if : github.event_name != 'schedule'
73- uses : docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0
74- with :
75- context : .
76- file : ./Dockerfile.tools
77- build-args : |
78- BASE_IMAGE=${{ env.IMAGE_REPO }}:${{ env.IMAGE_TAG }}
79- platforms : linux/amd64,linux/arm64
80- push : true
81- tags : |
82- ${{ env.IMAGE_REPO }}-tools:${{ env.IMAGE_TAG }}
83- ${{ env.IMAGE_REPO }}-tools:latest
67+ ${{ matrix.dockerfile == 'Dockerfile' && format('{0}:{1}', env.IMAGE_REPO, env.IMAGE_TAG) || format('{0}-tools:{1}', env.IMAGE_REPO, env.IMAGE_TAG) }}
68+ ${{ matrix.dockerfile == 'Dockerfile' && format('{0}:latest', env.IMAGE_REPO) || format('{0}-tools:latest', env.IMAGE_REPO) }}
8469 # Fix multi-platform: https://github.com/docker/buildx/issues/1533
8570 provenance : false
8671 secrets : |
8772 "github_token=${{ secrets.GITHUB_TOKEN }}"
8873
8974 - name : Test tools image
90- if : github.event_name != 'schedule'
75+ if : matrix.dockerfile == 'Dockerfile.tools' && github.event_name != 'schedule'
9176 env :
9277 IMAGE_TAG : ${{ env.IMAGE_REPO }}-tools:${{ env.IMAGE_TAG }}
9378 run : |
10388 uses : docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0
10489 with :
10590 context : .
91+ file : ${{ matrix.dockerfile }}
10692 build-args : |
10793 INSTALL_ALL=true
10894 platforms : linux/amd64,linux/arm64
@@ -113,20 +99,3 @@ jobs:
11399 provenance : false
114100 secrets : |
115101 "github_token=${{ secrets.GITHUB_TOKEN }}"
116-
117- - name : Build and Push tools nightly
118- if : github.event_name == 'schedule'
119- uses : docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0
120- with :
121- context : .
122- file : ./Dockerfile.tools
123- build-args : |
124- BASE_IMAGE=${{ env.IMAGE_REPO }}:nightly
125- platforms : linux/amd64,linux/arm64
126- push : true
127- tags : |
128- ${{ env.IMAGE_REPO }}-tools:nightly
129- # Fix multi-platform: https://github.com/docker/buildx/issues/1533
130- provenance : false
131- secrets : |
132- "github_token=${{ secrets.GITHUB_TOKEN }}"
0 commit comments