forked from devfile/api
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcomponent_image_dockerfile.go
81 lines (67 loc) · 2.64 KB
/
component_image_dockerfile.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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
package v1alpha2
// DockerfileSrcType describes the type of
// the src for the Dockerfile outerloop build.
// Only one of the following location type may be specified.
// +kubebuilder:validation:Enum=Uri;DevfileRegistry;Git
type DockerfileSrcType string
const (
UriLikeDockerfileSrcType DockerfileSrcType = "Uri"
DevfileRegistryLikeDockerfileSrcType DockerfileSrcType = "DevfileRegistry"
GitLikeDockerfileSrcType DockerfileSrcType = "Git"
)
// Dockerfile Image type to specify the outerloop build using a Dockerfile
type DockerfileImage struct {
BaseImage `json:",inline"`
DockerfileSrc `json:",inline"`
Dockerfile `json:",inline"`
}
// +union
type DockerfileSrc struct {
// Type of Dockerfile src
// +
// +unionDiscriminator
// +optional
SrcType DockerfileSrcType `json:"srcType,omitempty"`
// URI Reference of a Dockerfile.
// It can be a full URL or a relative URI from the current devfile as the base URI.
// +optional
Uri string `json:"uri,omitempty"`
// Dockerfile's Devfile Registry source
// +optional
DevfileRegistry *DockerfileDevfileRegistrySource `json:"devfileRegistry,omitempty"`
// Dockerfile's Git source
// +optional
Git *DockerfileGitProjectSource `json:"git,omitempty"`
}
type Dockerfile struct {
// Path of source directory to establish build context. Defaults to ${PROJECT_ROOT} in the container
// +optional
BuildContext string `json:"buildContext,omitempty"`
// The arguments to supply to the dockerfile build.
// +optional
Args []string `json:"args,omitempty" patchStrategy:"replace"`
// Specify if a privileged builder pod is required.
//
// Default value is `false`
// +optional
RootRequired *bool `json:"rootRequired,omitempty"`
}
type DockerfileDevfileRegistrySource struct {
// Id in a devfile registry that contains a Dockerfile. The src in the OCI registry
// required for the Dockerfile build will be downloaded for building the image.
Id string `json:"id"`
// Devfile Registry URL to pull the Dockerfile from when using the Devfile Registry as Dockerfile src.
// To ensure the Dockerfile gets resolved consistently in different environments,
// it is recommended to always specify the `devfileRegistryUrl` when `Id` is used.
// +optional
RegistryUrl string `json:"registryUrl,omitempty"`
}
type DockerfileGitProjectSource struct {
// Git src for the Dockerfile build. The src required for the Dockerfile build will need to be
// cloned for building the image.
GitProjectSource `json:",inline"`
// Location of the Dockerfile in the Git repository when using git as Dockerfile src.
// Defaults to Dockerfile.
// +optional
FileLocation string `json:"fileLocation,omitempty"`
}