Skip to content

Commit 83ec902

Browse files
authored
Merge pull request moby#5197 from candrews/frontend-oci-annotations
ci: add OCI image annotations to Dockerfile frontend images
2 parents f6eb72f + 862ea82 commit 83ec902

File tree

1 file changed

+18
-2
lines changed
  • frontend/dockerfile/cmd/dockerfile-frontend/hack

1 file changed

+18
-2
lines changed

frontend/dockerfile/cmd/dockerfile-frontend/hack/release

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,18 @@ if [[ "$RELEASE" = "true" ]] && [[ "$GITHUB_ACTIONS" = "true" ]]; then
7575
nocacheFilterFlag="--no-cache-filter=base"
7676
fi
7777

78+
outputFlag="type=image,$pushFlag"
79+
if [ "$GITHUB_ACTIONS" = "true" ]; then
80+
outputFlag="${outputFlag},\"annotation.org.opencontainers.image.title=Dockerfile Frontend\""
81+
if [ -n "$GITHUB_SHA" ]; then
82+
outputFlag="${outputFlag},annotation.org.opencontainers.image.revision=$GITHUB_SHA"
83+
fi
84+
if [ -n "$GITHUB_REPOSITORY" ] && [ -n "$GITHUB_SERVER_URL" ]; then
85+
outputFlag="${outputFlag},annotation.org.opencontainers.image.source=$GITHUB_SERVER_URL/$GITHUB_REPOSITORY"
86+
outputFlag="${outputFlag},annotation.org.opencontainers.image.url=$GITHUB_SERVER_URL/$GITHUB_REPOSITORY"
87+
fi
88+
fi
89+
7890
case $TYP in
7991
"master")
8092
tagf=./frontend/dockerfile/release/$TAG/tags
@@ -92,7 +104,7 @@ case $TYP in
92104
buildxCmd build $platformFlag $cacheFromFlags $cacheToFlags $nocacheFilterFlag $(buildAttestFlags) \
93105
--build-arg "CHANNEL=$TAG" \
94106
--build-arg "BUILDTAGS=$buildTags" \
95-
--output "type=image,name=$REPO:$pushTag,$pushFlag" \
107+
--output "${outputFlag},name=$REPO:$pushTag" \
96108
--file "./frontend/dockerfile/cmd/dockerfile-frontend/Dockerfile" \
97109
$currentcontext
98110
;;
@@ -105,11 +117,15 @@ case $TYP in
105117
exit 1
106118
fi
107119
buildTags=$(cat $tagf)
120+
outputFlag="${outputFlag},\"name=$publishedNames\""
121+
if [ "$GITHUB_ACTIONS" = "true" ]; then
122+
outputFlag="${outputFlag},annotation.org.opencontainers.image.version=$TAG"
123+
fi
108124

109125
buildxCmd build $platformFlag $cacheFromFlags $cacheToFlags $nocacheFilterFlag $(buildAttestFlags) \
110126
--build-arg "CHANNEL=$TAG" \
111127
--build-arg "BUILDTAGS=$buildTags" \
112-
--output "type=image,\"name=$publishedNames\",$pushFlag" \
128+
--output "$outputFlag" \
113129
--file "./frontend/dockerfile/cmd/dockerfile-frontend/Dockerfile" \
114130
$currentcontext
115131
;;

0 commit comments

Comments
 (0)