Skip to content

Commit 44e0594

Browse files
authored
Merge pull request #30 from Fortiphyd/add-image-signing
fix image signing
2 parents 381ea77 + 032f541 commit 44e0594

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

.github/workflows/docker-image.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ on:
1616
types: [ published ]
1717

1818
env:
19+
DOCKERHUB_NAMESPACE: fortiphyd
1920
DOCKER_TAG: ${{ github.ref_type == 'tag' && github.ref_name || 'latest' }}
2021

2122
jobs:
@@ -89,7 +90,7 @@ jobs:
8990

9091
- uses: docker/login-action@v3
9192
with:
92-
username: ${{ secrets.DOCKERHUB_USERNAME }}
93+
username: fortiphyd
9394
password: ${{ secrets.DOCKERHUB_TOKEN }}
9495

9596
- name: Build and push amd64 images
@@ -101,7 +102,7 @@ jobs:
101102
echo "⚠️ Skipping ${SERVICE}: directory does not exist"
102103
continue
103104
fi
104-
IMAGE="${{ secrets.DOCKERHUB_USERNAME }}/grfics-${SERVICE}"
105+
IMAGE="${DOCKERHUB_NAMESPACE}/grfics-${SERVICE}"
105106
echo "🚀 Building ${IMAGE}:${DOCKER_TAG} (amd64)"
106107
docker buildx build \
107108
--platform linux/amd64 \
@@ -190,7 +191,7 @@ jobs:
190191
set -euo pipefail
191192
SERVICES=$(echo '${{ needs.detect-changes.outputs.services }}' | jq -r '.[]')
192193
for SERVICE in $SERVICES; do
193-
REPO="${{ secrets.DOCKERHUB_USERNAME }}/grfics-${SERVICE}"
194+
REPO="${DOCKERHUB_NAMESPACE}/grfics-${SERVICE}"
194195
IMAGE="${REPO}:${DOCKER_TAG}"
195196
196197
echo "🔗 Creating multi-arch manifest for ${IMAGE}"
@@ -201,7 +202,7 @@ jobs:
201202
echo "✅ Multi-arch manifest published for ${IMAGE}"
202203
203204
echo "🔎 Resolving digest for ${IMAGE}"
204-
DIGEST="$(docker buildx imagetools inspect "${IMAGE}" --format '{{.Digest}}')"
205+
DIGEST="$(docker buildx imagetools inspect "${IMAGE}" --format '{{json .Manifest}}' | jq -r '.digest')"
205206
echo "🔏 Signing ${IMAGE}@${DIGEST} (keyless, GitHub OIDC, recursive)"
206207
cosign sign --recursive "${REPO}@${DIGEST}"
207208
echo "✅ Signed ${IMAGE}@${DIGEST}"

0 commit comments

Comments
 (0)