|
36 | 36 | runs-on: ${{ matrix.os }} |
37 | 37 | permissions: |
38 | 38 | packages: write |
| 39 | + env: |
| 40 | + PLATFORMS: 'linux/amd64 linux/arm64/v8' |
39 | 41 |
|
40 | 42 | steps: |
41 | 43 | - |
@@ -137,32 +139,42 @@ jobs: |
137 | 139 | registry: 'docker.io' |
138 | 140 | username: ${{ github.repository_owner }} |
139 | 141 | password: ${{ secrets.DOCKERHUB_TOKEN }} |
140 | | - |
141 | 142 | - |
142 | | - name: Upload Buildroot |
143 | | - uses: docker/build-push-action@v6 |
144 | | - with: |
145 | | - push: true |
146 | | - provenance: false |
147 | | - platforms: | |
148 | | - linux/amd64 |
149 | | - linux/arm64/v8 |
150 | | - context: "." |
151 | | - file: Dockerfile.alpine |
152 | | - target: buildroot |
153 | | - cache-to: | |
154 | | - type=gha |
155 | | - cache-from: | |
156 | | - type=gha |
157 | | - type=registry,ref=${{ steps.image_env.outputs.IMAGE_TAG }}-buildroot |
158 | | - type=registry,ref=${{ steps.image_env.outputs.SOURCE_IMAGE }}@${{ steps.image_env.outputs.BASE_IMAGE_DIGEST }} |
159 | | - build-args: | |
160 | | - ALPINE_VERSION=${{ steps.image_env.outputs.ALPINE_VERSION }} |
161 | | - BASE_IMAGE_DIGEST=${{ steps.image_env.outputs.BASE_IMAGE_DIGEST }} |
162 | | - PYTHON_VERSION=${{ steps.image_env.outputs.PYTHON_VERSION }} |
163 | | - SOURCE_IMAGE=${{ steps.image_env.outputs.SOURCE_IMAGE }} |
164 | | - BUILD_ROOT=/d |
165 | | - tags: "${{ steps.image_env.outputs.IMAGE_TAG }}-buildroot" |
| 143 | + env: |
| 144 | + IMAGE_URI: ${{ steps.image_env.outputs.IMAGE_TAG }}-buildroot |
| 145 | + run: | |
| 146 | + for platform in $PLATFORMS |
| 147 | + do |
| 148 | + docker build --platform "$platform" --push --cache-to type=gha --cache-from type=gha --build-arg 'ALPINE_VERSION=${{ steps.image_env.outputs.ALPINE_VERSION }}' --build-arg 'BASE_IMAGE_DIGEST=${{ steps.image_env.outputs.BASE_IMAGE_DIGEST }}' --build-arg 'PYTHON_VERSION=${{ steps.image_env.outputs.PYTHON_VERSION }}' --build-arg 'SOURCE_IMAGE=${{ steps.image_env.outputs.SOURCE_IMAGE }}' --build-arg 'BUILD_ROOT=/d' --tag "${IMAGE_URI}-$(echo "${platform}" | tr '/' '-' )" -f Dockerfile.alpine . |
| 149 | + echo "${IMAGE_URI}-$(echo "${platform}" | tr '/' '-' )" | tee -a $IMAGE_HOME/images.txt |
| 150 | + done |
| 151 | + docker manifest create "${IMAGE_URI}" $(cat $IMAGE_HOME/images.txt) |
| 152 | + docker manifest push "${IMAGE_URI}" |
| 153 | + # - |
| 154 | + # name: Upload Buildroot |
| 155 | + # uses: docker/build-push-action@v6 |
| 156 | + # with: |
| 157 | + # push: true |
| 158 | + # provenance: false |
| 159 | + # platforms: | |
| 160 | + # linux/amd64 |
| 161 | + # linux/arm64/v8 |
| 162 | + # context: "." |
| 163 | + # file: Dockerfile.alpine |
| 164 | + # target: buildroot |
| 165 | + # cache-to: | |
| 166 | + # type=gha |
| 167 | + # cache-from: | |
| 168 | + # type=gha |
| 169 | + # type=registry,ref=${{ steps.image_env.outputs.IMAGE_TAG }}-buildroot |
| 170 | + # type=registry,ref=${{ steps.image_env.outputs.SOURCE_IMAGE }}@${{ steps.image_env.outputs.BASE_IMAGE_DIGEST }} |
| 171 | + # build-args: | |
| 172 | + # ALPINE_VERSION=${{ steps.image_env.outputs.ALPINE_VERSION }} |
| 173 | + # BASE_IMAGE_DIGEST=${{ steps.image_env.outputs.BASE_IMAGE_DIGEST }} |
| 174 | + # PYTHON_VERSION=${{ steps.image_env.outputs.PYTHON_VERSION }} |
| 175 | + # SOURCE_IMAGE=${{ steps.image_env.outputs.SOURCE_IMAGE }} |
| 176 | + # BUILD_ROOT=/d |
| 177 | + # tags: "${{ steps.image_env.outputs.IMAGE_TAG }}-buildroot" |
166 | 178 | - |
167 | 179 | name: Upload |
168 | 180 | uses: docker/build-push-action@v6 |
|
0 commit comments