Skip to content

Commit 91fe623

Browse files
authored
Update docker-publish.yml
1 parent bf78315 commit 91fe623

File tree

1 file changed

+4
-14
lines changed

1 file changed

+4
-14
lines changed

.github/workflows/docker-publish.yml

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ env:
1313
jobs:
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

0 commit comments

Comments
 (0)