forked from aws/aws-cdk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-image-asset.ts
153 lines (137 loc) · 3.81 KB
/
docker-image-asset.ts
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
import { AwsDestination } from './aws-destination';
/**
* A file asset
*/
export interface DockerImageAsset {
/**
* Source description for file assets
*/
readonly source: DockerImageSource;
/**
* Destinations for this file asset
*/
readonly destinations: { [id: string]: DockerImageDestination };
}
/**
* Properties for how to produce a Docker image from a source
*/
export interface DockerImageSource {
/**
* The directory containing the Docker image build instructions.
*
* This path is relative to the asset manifest location.
*
* @default - Exactly one of `directory` and `executable` is required
*/
readonly directory?: string;
/**
* A command-line executable that returns the name of a local
* Docker image on stdout after being run.
*
* @default - Exactly one of `directory` and `executable` is required
*/
readonly executable?: string[];
/**
* The name of the file with build instructions
*
* Only allowed when `directory` is set.
*
* @default "Dockerfile"
*/
readonly dockerFile?: string;
/**
* Target build stage in a Dockerfile with multiple build stages
*
* Only allowed when `directory` is set.
*
* @default - The last stage in the Dockerfile
*/
readonly dockerBuildTarget?: string;
/**
* Additional build arguments
*
* Only allowed when `directory` is set.
*
* @default - No additional build arguments
*/
readonly dockerBuildArgs?: { [name: string]: string };
/**
* Additional build secrets
*
* Only allowed when `directory` is set.
*
* @default - No additional build secrets
*/
readonly dockerBuildSecrets?: { [name: string]: string };
/**
* Networking mode for the RUN commands during build. _Requires Docker Engine API v1.25+_.
*
* Specify this property to build images on a specific networking mode.
*
* @default - no networking mode specified
*/
readonly networkMode?: string;
/**
* Platform to build for. _Requires Docker Buildx_.
*
* Specify this property to build images on a specific platform/architecture.
*
* @default - current machine platform
*/
readonly platform?: string;
/**
* Outputs
*
* @default - no outputs are passed to the build command (default outputs are used)
* @see https://docs.docker.com/engine/reference/commandline/build/#custom-build-outputs
*/
readonly dockerOutputs?: string[];
/**
* Cache from options to pass to the `docker build` command.
*
* @default - no cache from options are passed to the build command
* @see https://docs.docker.com/build/cache/backends/
*/
readonly cacheFrom?: DockerCacheOption[];
/**
* Cache to options to pass to the `docker build` command.
*
* @default - no cache to options are passed to the build command
* @see https://docs.docker.com/build/cache/backends/
*/
readonly cacheTo?: DockerCacheOption;
}
/**
* Where to publish docker images
*/
export interface DockerImageDestination extends AwsDestination {
/**
* Name of the ECR repository to publish to
*/
readonly repositoryName: string;
/**
* Tag of the image to publish
*/
readonly imageTag: string;
}
/**
* Options for configuring the Docker cache backend
*/
export interface DockerCacheOption {
/**
* The type of cache to use.
* Refer to https://docs.docker.com/build/cache/backends/ for full list of backends.
* @default - unspecified
*
* @example 'registry'
*/
readonly type: string;
/**
* Any parameters to pass into the docker cache backend configuration.
* Refer to https://docs.docker.com/build/cache/backends/ for cache backend configuration.
* @default {} No options provided
*
* @example { ref: `12345678.dkr.ecr.us-west-2.amazonaws.com/cache:${branch}`, mode: "max" }
*/
readonly params?: { [key: string]: string };
}