-
Notifications
You must be signed in to change notification settings - Fork 6
/
dockermanifest.go
59 lines (51 loc) · 2.55 KB
/
dockermanifest.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
// Package dockermanifest represents the .NET Docker tooling's 'manifest.json' file. This file
// guides the .NET Docker infra to build and tag the Go Docker images correctly.
//
// For more details about this model, see the dotnet/docker-tools C# implementation:
// https://github.com/dotnet/docker-tools/blob/main/src/Microsoft.DotNet.ImageBuilder/src/Models/Manifest/Manifest.cs
// This implementation in Go only contains the subset of syntax that we actually use in the Go
// Docker repository.
package dockermanifest
// Manifest is the root object of a 'manifest.json' file.
type Manifest struct {
// Readme can be an object with more details, or a string path. This was recently changed from a
// string to an object in the .NET Docker infra's model. For now, be flexible in the go-images
// model: we only need to persist the value, not manipulate it.
Readme interface{} `json:"readme"`
Registry string `json:"registry"`
Variables map[string]interface{} `json:"variables"`
Includes []string `json:"includes"`
Repos []*Repo `json:"repos"`
}
// Repo is a Docker repository: the 'oss/go/microsoft/golang' part of a tag name.
type Repo struct {
ID string `json:"id"`
Name string `json:"name"`
Images []*Image `json:"images"`
}
// Image represents the build for a given version of Go. It contains the set of tags for this
// version, which may include multiple images for various OS/architectures.
type Image struct {
ProductVersion string `json:"productVersion"`
SharedTags map[string]Tag `json:"sharedTags"`
Platforms []*Platform `json:"platforms"`
}
// Platform is one OS+arch combination, and it maps to a specific Dockerfile in the Git repo.
type Platform struct {
BuildArgs map[string]string `json:"buildArgs,omitempty"`
// Architecture is the processor/os architecture the image should build for. This follows
// .NET Docker tooling values, which in turn follows GOARCH:
// https://go.dev/doc/install/source#environment
Architecture string `json:"architecture,omitempty"`
// Variant is a string used to further specify architecture. For example: "v8", for ARM.
Variant string `json:"variant,omitempty"`
Dockerfile string `json:"dockerfile"`
OS string `json:"os"`
OSVersion string `json:"osVersion"`
// Tags is a map of tag names to Tag metadata.
Tags map[string]Tag `json:"tags"`
}
// Tag is the metadata about a tag. Intentionally empty: we don't use any metadata yet.
type Tag struct{}