File tree Expand file tree Collapse file tree 1 file changed +4
-14
lines changed
Expand file tree Collapse file tree 1 file changed +4
-14
lines changed Original file line number Diff line number Diff line change 1313jobs :
1414 build-and-push :
1515 runs-on : ubuntu-latest
16+ permissions :
17+ contents : read
18+ packages : write
1619
1720 steps :
1821 - name : Checkout Repository
@@ -32,25 +35,12 @@ jobs:
3235 id : extract_tag
3336 run : echo "TAG_NAME=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
3437
35- - name : Extract Base Image from Dockerfile
36- id : get_base_image
37- run : |
38- BASE_IMAGE=$(grep -i '^FROM' Dockerfile | head -n 1 | awk '{print $2}')
39- echo "BASE_IMAGE=$BASE_IMAGE" >> $GITHUB_ENV
40-
41- - name : Get Supported Platforms
42- id : get_platforms
43- run : |
44- PLATFORMS=$(docker buildx imagetools inspect ${{ env.BASE_IMAGE }} --format '{{ range .Manifest.Platforms }}{{ .OS }}/{{ .Architecture }},{{ end }}' | sed 's/,$//')
45- echo "PLATFORMS=$PLATFORMS" >> $GITHUB_ENV
46- shell : bash
47-
4838 - name : Build and Push Docker Image (Multi-Arch)
4939 uses : docker/build-push-action@v5
5040 with :
5141 context : .
5242 push : true
53- platforms : ${{ env.PLATFORMS }}
43+ platforms : linux/amd64, linux/arm64
5444 tags : |
5545 ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.TAG_NAME }}
5646 ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
You can’t perform that action at this time.
0 commit comments