@@ -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/usage/docker" ,
21
22
$ "org.opencontainers.image.created={ DateTime . UtcNow : O} ",
22
23
] ;
23
24
@@ -49,7 +50,12 @@ 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 } ";
58
+ var source = $ "org.opencontainers.image.source=https://github.com/GitTools/GitVersion/blob/{ context . Version . GitVersion . Sha } /build/docker/Dockerfile";
53
59
54
60
var buildSettings = new DockerBuildXBuildSettings
55
61
{
@@ -72,11 +78,19 @@ public static void DockerBuildImage(this BuildContextBase context, DockerImage d
72
78
[
73
79
"maintainers=GitTools Maintainers" ,
74
80
.. Annotations ,
81
+ baseName ,
82
+ version ,
83
+ source ,
84
+ revision ,
75
85
description
76
86
] ,
77
87
Annotation =
78
88
[
79
89
.. Annotations ,
90
+ baseName ,
91
+ version ,
92
+ source ,
93
+ revision ,
80
94
description
81
95
]
82
96
} ;
@@ -100,7 +114,7 @@ public static void DockerManifest(this BuildContextBase context, DockerImage doc
100
114
var amd64Tag = $ "{ tag } -{ Architecture . Amd64 . ToSuffix ( ) } ";
101
115
var arm64Tag = $ "{ tag } -{ Architecture . Arm64 . ToSuffix ( ) } ";
102
116
103
- var settings = GetManifestSettings ( dockerImage , context . Version ! . NugetVersion ! , tag ) ;
117
+ var settings = GetManifestSettings ( dockerImage , context . Version ! , tag ) ;
104
118
context . DockerBuildXImageToolsCreate ( settings , [ amd64Tag , arm64Tag ] ) ;
105
119
}
106
120
}
@@ -127,17 +141,21 @@ public static void DockerPushImage(this BuildContextBase context, DockerImage do
127
141
}
128
142
}
129
143
130
- public static DockerBuildXImageToolsCreateSettings GetManifestSettings ( DockerImage dockerImage , string version , string tag )
144
+ public static DockerBuildXImageToolsCreateSettings GetManifestSettings ( DockerImage dockerImage , BuildVersion buildVersion , string tag )
131
145
{
132
- var imageSuffix = $ "({ dockerImage . Distro } -{ version } -{ dockerImage . TargetFramework } )";
146
+ var imageSuffix = $ "({ dockerImage . Distro } -{ buildVersion . NugetVersion } -{ dockerImage . TargetFramework } )";
133
147
var description = $ "org.opencontainers.image.description=GitVersion images { imageSuffix } ";
148
+ var version = $ "org.opencontainers.image.version={ buildVersion . NugetVersion } ";
149
+ var revision = $ "org.opencontainers.image.revision={ buildVersion . GitVersion . Sha } ";
134
150
var settings = new DockerBuildXImageToolsCreateSettings
135
151
{
136
152
Tag = [ tag ] ,
137
153
Annotation =
138
154
[
139
155
.. Annotations . Select ( a => "index:" + a ) . ToArray ( ) ,
140
156
$ "index:{ description } ",
157
+ $ "index:{ version } ",
158
+ $ "index:{ revision } "
141
159
]
142
160
} ;
143
161
return settings ;
0 commit comments