@@ -18,6 +18,7 @@ public static class DockerContextExtensions
1818 "org.opencontainers.image.vendor=GitTools" ,
1919 "org.opencontainers.image.licenses=MIT" ,
2020 "org.opencontainers.image.source=https://github.com/GitTools/GitVersion.git" ,
21+ "org.opencontainers.image.documentation=https://gitversion.net/docs/" ,
2122 $ "org.opencontainers.image.created={ DateTime . UtcNow : O} ",
2223 ] ;
2324
@@ -49,7 +50,11 @@ public static void DockerBuildImage(this BuildContextBase context, DockerImage d
4950
5051 var suffix = arch . ToSuffix ( ) ;
5152 var imageSuffix = $ "({ distro } -{ context . Version . NugetVersion } -{ targetFramework } -{ arch . ToSuffix ( ) } )";
53+ var baseNameSuffix = $ "{ registry } /{ Constants . DockerBaseImageName } :{ distro } -runtime-{ targetFramework } -{ arch . ToSuffix ( ) } ";
5254 var description = $ "org.opencontainers.image.description=GitVersion images { imageSuffix } ";
55+ var baseName = $ "org.opencontainers.image.base.name={ baseNameSuffix } ";
56+ var version = $ "org.opencontainers.image.version={ context . Version . NugetVersion } ";
57+ var revision = $ "org.opencontainers.image.revision={ context . Version . GitVersion . Sha } ";
5358
5459 var buildSettings = new DockerBuildXBuildSettings
5560 {
@@ -72,11 +77,17 @@ public static void DockerBuildImage(this BuildContextBase context, DockerImage d
7277 [
7378 "maintainers=GitTools Maintainers" ,
7479 .. Annotations ,
80+ baseName ,
81+ version ,
82+ revision ,
7583 description
7684 ] ,
7785 Annotation =
7886 [
7987 .. Annotations ,
88+ baseName ,
89+ version ,
90+ revision ,
8091 description
8192 ]
8293 } ;
@@ -100,7 +111,7 @@ public static void DockerManifest(this BuildContextBase context, DockerImage doc
100111 var amd64Tag = $ "{ tag } -{ Architecture . Amd64 . ToSuffix ( ) } ";
101112 var arm64Tag = $ "{ tag } -{ Architecture . Arm64 . ToSuffix ( ) } ";
102113
103- var settings = GetManifestSettings ( dockerImage , context . Version ! . NugetVersion ! , tag ) ;
114+ var settings = GetManifestSettings ( dockerImage , context . Version ! , tag ) ;
104115 context . DockerBuildXImageToolsCreate ( settings , [ amd64Tag , arm64Tag ] ) ;
105116 }
106117 }
@@ -127,17 +138,21 @@ public static void DockerPushImage(this BuildContextBase context, DockerImage do
127138 }
128139 }
129140
130- public static DockerBuildXImageToolsCreateSettings GetManifestSettings ( DockerImage dockerImage , string version , string tag )
141+ public static DockerBuildXImageToolsCreateSettings GetManifestSettings ( DockerImage dockerImage , BuildVersion buildVersion , string tag )
131142 {
132- var imageSuffix = $ "({ dockerImage . Distro } -{ version } -{ dockerImage . TargetFramework } )";
143+ var imageSuffix = $ "({ dockerImage . Distro } -{ buildVersion . NugetVersion } -{ dockerImage . TargetFramework } )";
133144 var description = $ "org.opencontainers.image.description=GitVersion images { imageSuffix } ";
145+ var version = $ "org.opencontainers.image.version={ buildVersion . NugetVersion } ";
146+ var revision = $ "org.opencontainers.image.revision={ buildVersion . GitVersion . Sha } ";
134147 var settings = new DockerBuildXImageToolsCreateSettings
135148 {
136149 Tag = [ tag ] ,
137150 Annotation =
138151 [
139152 .. Annotations . Select ( a => "index:" + a ) . ToArray ( ) ,
140153 $ "index:{ description } ",
154+ $ "index:{ version } ",
155+ $ "index:{ revision } "
141156 ]
142157 } ;
143158 return settings ;
0 commit comments