@@ -18,6 +18,7 @@ public static class DockerContextExtensions
18
18
"org.opencontainers.image.vendor=GitTools" ,
19
19
"org.opencontainers.image.licenses=MIT" ,
20
20
"org.opencontainers.image.source=https://github.com/GitTools/GitVersion.git" ,
21
+ "org.opencontainers.image.documentation=https://gitversion.net/docs/" ,
21
22
$ "org.opencontainers.image.created={ DateTime . UtcNow : O} ",
22
23
] ;
23
24
@@ -49,7 +50,11 @@ public static void DockerBuildImage(this BuildContextBase context, DockerImage d
49
50
50
51
var suffix = arch . ToSuffix ( ) ;
51
52
var imageSuffix = $ "({ distro } -{ context . Version . NugetVersion } -{ targetFramework } -{ arch . ToSuffix ( ) } )";
53
+ var baseNameSuffix = $ "{ registry } /{ Constants . DockerBaseImageName } :{ distro } -runtime-{ targetFramework } -{ arch . ToSuffix ( ) } ";
52
54
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 } ";
53
58
54
59
var buildSettings = new DockerBuildXBuildSettings
55
60
{
@@ -72,11 +77,17 @@ public static void DockerBuildImage(this BuildContextBase context, DockerImage d
72
77
[
73
78
"maintainers=GitTools Maintainers" ,
74
79
.. Annotations ,
80
+ baseName ,
81
+ version ,
82
+ revision ,
75
83
description
76
84
] ,
77
85
Annotation =
78
86
[
79
87
.. Annotations ,
88
+ baseName ,
89
+ version ,
90
+ revision ,
80
91
description
81
92
]
82
93
} ;
@@ -100,7 +111,7 @@ public static void DockerManifest(this BuildContextBase context, DockerImage doc
100
111
var amd64Tag = $ "{ tag } -{ Architecture . Amd64 . ToSuffix ( ) } ";
101
112
var arm64Tag = $ "{ tag } -{ Architecture . Arm64 . ToSuffix ( ) } ";
102
113
103
- var settings = GetManifestSettings ( dockerImage , context . Version ! . NugetVersion ! , tag ) ;
114
+ var settings = GetManifestSettings ( dockerImage , context . Version ! , tag ) ;
104
115
context . DockerBuildXImageToolsCreate ( settings , [ amd64Tag , arm64Tag ] ) ;
105
116
}
106
117
}
@@ -127,17 +138,21 @@ public static void DockerPushImage(this BuildContextBase context, DockerImage do
127
138
}
128
139
}
129
140
130
- public static DockerBuildXImageToolsCreateSettings GetManifestSettings ( DockerImage dockerImage , string version , string tag )
141
+ public static DockerBuildXImageToolsCreateSettings GetManifestSettings ( DockerImage dockerImage , BuildVersion buildVersion , string tag )
131
142
{
132
- var imageSuffix = $ "({ dockerImage . Distro } -{ version } -{ dockerImage . TargetFramework } )";
143
+ var imageSuffix = $ "({ dockerImage . Distro } -{ buildVersion . NugetVersion } -{ dockerImage . TargetFramework } )";
133
144
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 } ";
134
147
var settings = new DockerBuildXImageToolsCreateSettings
135
148
{
136
149
Tag = [ tag ] ,
137
150
Annotation =
138
151
[
139
152
.. Annotations . Select ( a => "index:" + a ) . ToArray ( ) ,
140
153
$ "index:{ description } ",
154
+ $ "index:{ version } ",
155
+ $ "index:{ revision } "
141
156
]
142
157
} ;
143
158
return settings ;
0 commit comments