1515 default : ' manual-build'
1616
1717env :
18+ # Container Image Labeling
19+ TEAM_ORGDATA_EMAIL : " api.eng.ept@vonage.com"
20+ TEAM_ORGDATA_ID : " ept"
1821 # Default values - customize these for your project
1922 DEFAULT_IMAGE_TITLE : " My Example Application"
20- IMAGE_AUTHORS : " platform-team@example.com,#slack-platform-team "
23+
2124 IMAGE_VENDOR : " ACME Corporation"
2225 IMAGE_LICENSES : " Apache-2.0"
2326
6770
6871 echo "Base image digest: $BASE_DIGEST"
6972
73+ - name : Get SPDX license id
74+ id : license
75+ env :
76+ GH_TOKEN : ${{ github.token }}
77+ run : |
78+ spdx=$(
79+ curl -sS \
80+ -H "Authorization: Bearer $GH_TOKEN" \
81+ -H "Accept: application/vnd.github+json" \
82+ "${{ github.api_url }}/repos/${{ github.repository }}/license" \
83+ | jq -r '.license.spdx_id // empty'
84+ )
85+
86+ if [ -z "$spdx" ] || [ "$spdx" = "NOASSERTION" ]; then
87+ echo "Could not determine SPDX id (missing license or unrecognized)."
88+ exit 1
89+ fi
90+
91+ echo "spdx=$spdx" >> "$GITHUB_OUTPUT"
92+ echo "SPDX: $spdx"
93+
7094 - name : Generate Docker metadata
7195 id : meta
7296 uses : docker/metadata-action@v5
@@ -78,16 +102,16 @@ jobs:
78102 type=raw,value=latest,enable={{is_default_branch}}
79103 # Labels using OCI standard keys
80104 labels : |
81- org.opencontainers.image.title=${{ env.DEFAULT_IMAGE_TITLE }}
82- org.opencontainers.image.description=${{ github.event.repository.description }}"
83- org.opencontainers.image.authors=${{ env.IMAGE_AUTHORS }}
84- org.opencontainers.image.vendor=${{ env.IMAGE_VENDOR }}
85- org.opencontainers.image.licenses=${{ env.IMAGE_LICENSES }}
86- org.opencontainers.image.url=${{ github.repositoryUrl }}/test-app/Dockerfile
87- org.opencontainers.image.documentation=https://github.com/${{ github.repository }}/blob/main/docs/README.md
105+ org.opencontainers.image.authors=${{ env.TEAM_ORGDATA_EMAIL }}
106+ com.vonage.orgdata.id=${{ env.TEAM_ORGDATA_ID }}
107+ org.opencontainers.image.title=${{ github.event.repository }}
88108 org.opencontainers.image.base.name=${{ steps.base_image.outputs.name }}
89109 org.opencontainers.image.base.digest=${{ steps.base_image.outputs.digest }}
90-
110+ org.opencontainers.image.description=${{ github.event.repository.description }}
111+ org.opencontainers.image.url=${{ github.repositoryUrl }}/test-app/Dockerfile
112+ org.opencontainers.image.documentation=${{ github.repositoryUrl }}/README.md
113+ org.opencontainers.image.vendor=${{ github.repository_owner }}
114+ org.opencontainers.image.licenses=${{ steps.license.outputs.spdx }}
91115 - name : Build the app
92116 run : |
93117 cd test-app
@@ -110,4 +134,4 @@ jobs:
110134 echo "Image: $IMAGE"
111135 echo ""
112136
113- docker inspect "$IMAGE" --format='{{json .Config.Labels}}' | jq '.'
137+ docker inspect "$IMAGE" --format='{{json .Config.Labels}}' | jq '.'
0 commit comments