token-injectable-docker-builder 1.13.3 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.jsii +260 -143
- package/API.md +196 -136
- package/README.md +156 -71
- package/ecrReplication/ecrReplication.js +156 -0
- package/isComplete/isComplete.js +63 -4
- package/lib/build-spec.d.ts +24 -0
- package/lib/build-spec.js +104 -0
- package/lib/builder.d.ts +206 -0
- package/lib/builder.js +289 -0
- package/lib/constants.d.ts +7 -0
- package/lib/constants.js +11 -0
- package/lib/ecr.d.ts +16 -0
- package/lib/ecr.js +30 -0
- package/lib/index.d.ts +2 -261
- package/lib/index.js +6 -402
- package/lib/provider.d.ts +63 -0
- package/lib/provider.js +212 -0
- package/package.json +10 -5
package/API.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
### TokenInjectableDockerBuilder <a name="TokenInjectableDockerBuilder" id="token-injectable-docker-builder.TokenInjectableDockerBuilder"></a>
|
|
6
6
|
|
|
7
|
-
A CDK construct to build and push Docker images to an ECR repository using CodeBuild and Lambda custom resources, **then** retrieve the final image tag so that ECS/Lambda references use the exact
|
|
7
|
+
A CDK construct to build and push Docker images to an ECR repository using CodeBuild and Lambda custom resources, **then** retrieve the final image tag so that ECS/Lambda references use the exact built image.
|
|
8
8
|
|
|
9
9
|
#### Initializers <a name="Initializers" id="token-injectable-docker-builder.TokenInjectableDockerBuilder.Initializer"></a>
|
|
10
10
|
|
|
@@ -16,9 +16,9 @@ new TokenInjectableDockerBuilder(scope: Construct, id: string, props: TokenInjec
|
|
|
16
16
|
|
|
17
17
|
| **Name** | **Type** | **Description** |
|
|
18
18
|
| --- | --- | --- |
|
|
19
|
-
| <code><a href="#token-injectable-docker-builder.TokenInjectableDockerBuilder.Initializer.parameter.scope">scope</a></code> | <code>constructs.Construct</code> |
|
|
20
|
-
| <code><a href="#token-injectable-docker-builder.TokenInjectableDockerBuilder.Initializer.parameter.id">id</a></code> | <code>string</code> |
|
|
21
|
-
| <code><a href="#token-injectable-docker-builder.TokenInjectableDockerBuilder.Initializer.parameter.props">props</a></code> | <code><a href="#token-injectable-docker-builder.TokenInjectableDockerBuilderProps">TokenInjectableDockerBuilderProps</a></code> |
|
|
19
|
+
| <code><a href="#token-injectable-docker-builder.TokenInjectableDockerBuilder.Initializer.parameter.scope">scope</a></code> | <code>constructs.Construct</code> | *No description.* |
|
|
20
|
+
| <code><a href="#token-injectable-docker-builder.TokenInjectableDockerBuilder.Initializer.parameter.id">id</a></code> | <code>string</code> | *No description.* |
|
|
21
|
+
| <code><a href="#token-injectable-docker-builder.TokenInjectableDockerBuilder.Initializer.parameter.props">props</a></code> | <code><a href="#token-injectable-docker-builder.TokenInjectableDockerBuilderProps">TokenInjectableDockerBuilderProps</a></code> | *No description.* |
|
|
22
22
|
|
|
23
23
|
---
|
|
24
24
|
|
|
@@ -26,24 +26,18 @@ new TokenInjectableDockerBuilder(scope: Construct, id: string, props: TokenInjec
|
|
|
26
26
|
|
|
27
27
|
- *Type:* constructs.Construct
|
|
28
28
|
|
|
29
|
-
The scope in which to define this construct.
|
|
30
|
-
|
|
31
29
|
---
|
|
32
30
|
|
|
33
31
|
##### `id`<sup>Required</sup> <a name="id" id="token-injectable-docker-builder.TokenInjectableDockerBuilder.Initializer.parameter.id"></a>
|
|
34
32
|
|
|
35
33
|
- *Type:* string
|
|
36
34
|
|
|
37
|
-
The scoped construct ID.
|
|
38
|
-
|
|
39
35
|
---
|
|
40
36
|
|
|
41
37
|
##### `props`<sup>Required</sup> <a name="props" id="token-injectable-docker-builder.TokenInjectableDockerBuilder.Initializer.parameter.props"></a>
|
|
42
38
|
|
|
43
39
|
- *Type:* <a href="#token-injectable-docker-builder.TokenInjectableDockerBuilderProps">TokenInjectableDockerBuilderProps</a>
|
|
44
40
|
|
|
45
|
-
Configuration for building and pushing the Docker image.
|
|
46
|
-
|
|
47
41
|
---
|
|
48
42
|
|
|
49
43
|
#### Methods <a name="Methods" id="Methods"></a>
|
|
@@ -52,6 +46,9 @@ Configuration for building and pushing the Docker image.
|
|
|
52
46
|
| --- | --- |
|
|
53
47
|
| <code><a href="#token-injectable-docker-builder.TokenInjectableDockerBuilder.toString">toString</a></code> | Returns a string representation of this construct. |
|
|
54
48
|
| <code><a href="#token-injectable-docker-builder.TokenInjectableDockerBuilder.with">with</a></code> | Applies one or more mixins to this construct. |
|
|
49
|
+
| <code><a href="#token-injectable-docker-builder.TokenInjectableDockerBuilder.containerImageFor">containerImageFor</a></code> | Import the replicated repository as an ECS-compatible `ContainerImage` in a consumer scope (typically a stack in `region`). |
|
|
50
|
+
| <code><a href="#token-injectable-docker-builder.TokenInjectableDockerBuilder.dockerImageCodeFor">dockerImageCodeFor</a></code> | Import the replicated repository as a Lambda-compatible `DockerImageCode` in a consumer scope (typically a stack in `region`). |
|
|
51
|
+
| <code><a href="#token-injectable-docker-builder.TokenInjectableDockerBuilder.repositoryUriFor">repositoryUriFor</a></code> | Format the ECR repository URI for a given region. |
|
|
55
52
|
|
|
56
53
|
---
|
|
57
54
|
|
|
@@ -84,6 +81,69 @@ The mixins to apply.
|
|
|
84
81
|
|
|
85
82
|
---
|
|
86
83
|
|
|
84
|
+
##### `containerImageFor` <a name="containerImageFor" id="token-injectable-docker-builder.TokenInjectableDockerBuilder.containerImageFor"></a>
|
|
85
|
+
|
|
86
|
+
```typescript
|
|
87
|
+
public containerImageFor(scope: Construct, region: string): ContainerImage
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
Import the replicated repository as an ECS-compatible `ContainerImage` in a consumer scope (typically a stack in `region`).
|
|
91
|
+
|
|
92
|
+
The consumer's stack must have `crossRegionReferences: true` when
|
|
93
|
+
`region` differs from the builder's region.
|
|
94
|
+
|
|
95
|
+
###### `scope`<sup>Required</sup> <a name="scope" id="token-injectable-docker-builder.TokenInjectableDockerBuilder.containerImageFor.parameter.scope"></a>
|
|
96
|
+
|
|
97
|
+
- *Type:* constructs.Construct
|
|
98
|
+
|
|
99
|
+
---
|
|
100
|
+
|
|
101
|
+
###### `region`<sup>Required</sup> <a name="region" id="token-injectable-docker-builder.TokenInjectableDockerBuilder.containerImageFor.parameter.region"></a>
|
|
102
|
+
|
|
103
|
+
- *Type:* string
|
|
104
|
+
|
|
105
|
+
---
|
|
106
|
+
|
|
107
|
+
##### `dockerImageCodeFor` <a name="dockerImageCodeFor" id="token-injectable-docker-builder.TokenInjectableDockerBuilder.dockerImageCodeFor"></a>
|
|
108
|
+
|
|
109
|
+
```typescript
|
|
110
|
+
public dockerImageCodeFor(scope: Construct, region: string): DockerImageCode
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
Import the replicated repository as a Lambda-compatible `DockerImageCode` in a consumer scope (typically a stack in `region`).
|
|
114
|
+
|
|
115
|
+
The consumer's stack must have `crossRegionReferences: true` when
|
|
116
|
+
`region` differs from the builder's region.
|
|
117
|
+
|
|
118
|
+
###### `scope`<sup>Required</sup> <a name="scope" id="token-injectable-docker-builder.TokenInjectableDockerBuilder.dockerImageCodeFor.parameter.scope"></a>
|
|
119
|
+
|
|
120
|
+
- *Type:* constructs.Construct
|
|
121
|
+
|
|
122
|
+
---
|
|
123
|
+
|
|
124
|
+
###### `region`<sup>Required</sup> <a name="region" id="token-injectable-docker-builder.TokenInjectableDockerBuilder.dockerImageCodeFor.parameter.region"></a>
|
|
125
|
+
|
|
126
|
+
- *Type:* string
|
|
127
|
+
|
|
128
|
+
---
|
|
129
|
+
|
|
130
|
+
##### `repositoryUriFor` <a name="repositoryUriFor" id="token-injectable-docker-builder.TokenInjectableDockerBuilder.repositoryUriFor"></a>
|
|
131
|
+
|
|
132
|
+
```typescript
|
|
133
|
+
public repositoryUriFor(region: string): string
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
Format the ECR repository URI for a given region.
|
|
137
|
+
|
|
138
|
+
The region must
|
|
139
|
+
be either the primary region or one of `replicaRegions`.
|
|
140
|
+
|
|
141
|
+
###### `region`<sup>Required</sup> <a name="region" id="token-injectable-docker-builder.TokenInjectableDockerBuilder.repositoryUriFor.parameter.region"></a>
|
|
142
|
+
|
|
143
|
+
- *Type:* string
|
|
144
|
+
|
|
145
|
+
---
|
|
146
|
+
|
|
87
147
|
#### Static Functions <a name="Static Functions" id="Static Functions"></a>
|
|
88
148
|
|
|
89
149
|
| **Name** | **Description** |
|
|
@@ -129,8 +189,10 @@ Any object.
|
|
|
129
189
|
| **Name** | **Type** | **Description** |
|
|
130
190
|
| --- | --- | --- |
|
|
131
191
|
| <code><a href="#token-injectable-docker-builder.TokenInjectableDockerBuilder.property.node">node</a></code> | <code>constructs.Node</code> | The tree node. |
|
|
132
|
-
| <code><a href="#token-injectable-docker-builder.TokenInjectableDockerBuilder.property.containerImage">containerImage</a></code> | <code>aws-cdk-lib.aws_ecs.ContainerImage</code> |
|
|
133
|
-
| <code><a href="#token-injectable-docker-builder.TokenInjectableDockerBuilder.property.dockerImageCode">dockerImageCode</a></code> | <code>aws-cdk-lib.aws_lambda.DockerImageCode</code> |
|
|
192
|
+
| <code><a href="#token-injectable-docker-builder.TokenInjectableDockerBuilder.property.containerImage">containerImage</a></code> | <code>aws-cdk-lib.aws_ecs.ContainerImage</code> | ECS-compatible container image reference (primary region). |
|
|
193
|
+
| <code><a href="#token-injectable-docker-builder.TokenInjectableDockerBuilder.property.dockerImageCode">dockerImageCode</a></code> | <code>aws-cdk-lib.aws_lambda.DockerImageCode</code> | Lambda-compatible DockerImageCode reference (primary region). |
|
|
194
|
+
| <code><a href="#token-injectable-docker-builder.TokenInjectableDockerBuilder.property.imageTag">imageTag</a></code> | <code>string</code> | The resolved image tag (CFN token; |
|
|
195
|
+
| <code><a href="#token-injectable-docker-builder.TokenInjectableDockerBuilder.property.repositoryName">repositoryName</a></code> | <code>string</code> | The ECR repository name — preserved across replica regions. |
|
|
134
196
|
|
|
135
197
|
---
|
|
136
198
|
|
|
@@ -154,7 +216,7 @@ public readonly containerImage: ContainerImage;
|
|
|
154
216
|
|
|
155
217
|
- *Type:* aws-cdk-lib.aws_ecs.ContainerImage
|
|
156
218
|
|
|
157
|
-
|
|
219
|
+
ECS-compatible container image reference (primary region).
|
|
158
220
|
|
|
159
221
|
---
|
|
160
222
|
|
|
@@ -166,7 +228,33 @@ public readonly dockerImageCode: DockerImageCode;
|
|
|
166
228
|
|
|
167
229
|
- *Type:* aws-cdk-lib.aws_lambda.DockerImageCode
|
|
168
230
|
|
|
169
|
-
|
|
231
|
+
Lambda-compatible DockerImageCode reference (primary region).
|
|
232
|
+
|
|
233
|
+
---
|
|
234
|
+
|
|
235
|
+
##### `imageTag`<sup>Required</sup> <a name="imageTag" id="token-injectable-docker-builder.TokenInjectableDockerBuilder.property.imageTag"></a>
|
|
236
|
+
|
|
237
|
+
```typescript
|
|
238
|
+
public readonly imageTag: string;
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
- *Type:* string
|
|
242
|
+
|
|
243
|
+
The resolved image tag (CFN token;
|
|
244
|
+
|
|
245
|
+
available at deploy time).
|
|
246
|
+
|
|
247
|
+
---
|
|
248
|
+
|
|
249
|
+
##### `repositoryName`<sup>Required</sup> <a name="repositoryName" id="token-injectable-docker-builder.TokenInjectableDockerBuilder.property.repositoryName"></a>
|
|
250
|
+
|
|
251
|
+
```typescript
|
|
252
|
+
public readonly repositoryName: string;
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
- *Type:* string
|
|
256
|
+
|
|
257
|
+
The ECR repository name — preserved across replica regions.
|
|
170
258
|
|
|
171
259
|
---
|
|
172
260
|
|
|
@@ -186,6 +274,7 @@ shared Lambdas have permission to start builds and read logs.
|
|
|
186
274
|
| <code><a href="#token-injectable-docker-builder.TokenInjectableDockerBuilderProvider.toString">toString</a></code> | Returns a string representation of this construct. |
|
|
187
275
|
| <code><a href="#token-injectable-docker-builder.TokenInjectableDockerBuilderProvider.with">with</a></code> | Applies one or more mixins to this construct. |
|
|
188
276
|
| <code><a href="#token-injectable-docker-builder.TokenInjectableDockerBuilderProvider.registerProject">registerProject</a></code> | Grant the shared Lambdas permission to start builds for a specific CodeBuild project and pull/push to its ECR repository. |
|
|
277
|
+
| <code><a href="#token-injectable-docker-builder.TokenInjectableDockerBuilderProvider.registerReplication">registerReplication</a></code> | Register a builder's replica regions with the singleton's replication-config custom resource. |
|
|
189
278
|
|
|
190
279
|
---
|
|
191
280
|
|
|
@@ -244,6 +333,32 @@ Grant the shared Lambdas permission to start builds for a specific CodeBuild pro
|
|
|
244
333
|
|
|
245
334
|
---
|
|
246
335
|
|
|
336
|
+
##### `registerReplication` <a name="registerReplication" id="token-injectable-docker-builder.TokenInjectableDockerBuilderProvider.registerReplication"></a>
|
|
337
|
+
|
|
338
|
+
```typescript
|
|
339
|
+
public registerReplication(repoName: string, replicaRegions: string[]): void
|
|
340
|
+
```
|
|
341
|
+
|
|
342
|
+
Register a builder's replica regions with the singleton's replication-config custom resource.
|
|
343
|
+
|
|
344
|
+
Multiple builders contribute specs; the CR merges them into
|
|
345
|
+
a single registry-wide configuration on every deploy.
|
|
346
|
+
|
|
347
|
+
Also grants the `isComplete` Lambda permission to BatchGetImage on each
|
|
348
|
+
replica region's repo so it can poll for replication availability.
|
|
349
|
+
|
|
350
|
+
###### `repoName`<sup>Required</sup> <a name="repoName" id="token-injectable-docker-builder.TokenInjectableDockerBuilderProvider.registerReplication.parameter.repoName"></a>
|
|
351
|
+
|
|
352
|
+
- *Type:* string
|
|
353
|
+
|
|
354
|
+
---
|
|
355
|
+
|
|
356
|
+
###### `replicaRegions`<sup>Required</sup> <a name="replicaRegions" id="token-injectable-docker-builder.TokenInjectableDockerBuilderProvider.registerReplication.parameter.replicaRegions"></a>
|
|
357
|
+
|
|
358
|
+
- *Type:* string[]
|
|
359
|
+
|
|
360
|
+
---
|
|
361
|
+
|
|
247
362
|
#### Static Functions <a name="Static Functions" id="Static Functions"></a>
|
|
248
363
|
|
|
249
364
|
| **Name** | **Description** |
|
|
@@ -366,20 +481,19 @@ const tokenInjectableDockerBuilderProps: TokenInjectableDockerBuilderProps = { .
|
|
|
366
481
|
| <code><a href="#token-injectable-docker-builder.TokenInjectableDockerBuilderProps.property.buildArgs">buildArgs</a></code> | <code>{[ key: string ]: string}</code> | Build arguments to pass to the Docker build process. |
|
|
367
482
|
| <code><a href="#token-injectable-docker-builder.TokenInjectableDockerBuilderProps.property.buildLogGroup">buildLogGroup</a></code> | <code>aws-cdk-lib.aws_logs.ILogGroup</code> | CloudWatch log group for CodeBuild build logs. |
|
|
368
483
|
| <code><a href="#token-injectable-docker-builder.TokenInjectableDockerBuilderProps.property.cacheDisabled">cacheDisabled</a></code> | <code>boolean</code> | When `true`, disables Docker layer caching. |
|
|
369
|
-
| <code><a href="#token-injectable-docker-builder.TokenInjectableDockerBuilderProps.property.completenessQueryInterval">completenessQueryInterval</a></code> | <code>aws-cdk-lib.Duration</code> | The query interval for checking if the CodeBuild project has completed. |
|
|
370
484
|
| <code><a href="#token-injectable-docker-builder.TokenInjectableDockerBuilderProps.property.dockerLoginSecretArn">dockerLoginSecretArn</a></code> | <code>string</code> | The ARN of the AWS Secrets Manager secret containing Docker login credentials. |
|
|
371
485
|
| <code><a href="#token-injectable-docker-builder.TokenInjectableDockerBuilderProps.property.ecrPullThroughCachePrefixes">ecrPullThroughCachePrefixes</a></code> | <code>string[]</code> | ECR pull-through cache repository prefixes to grant pull access to. |
|
|
372
|
-
| <code><a href="#token-injectable-docker-builder.TokenInjectableDockerBuilderProps.property.exclude">exclude</a></code> | <code>string[]</code> |
|
|
373
|
-
| <code><a href="#token-injectable-docker-builder.TokenInjectableDockerBuilderProps.property.file">file</a></code> | <code>string</code> |
|
|
486
|
+
| <code><a href="#token-injectable-docker-builder.TokenInjectableDockerBuilderProps.property.exclude">exclude</a></code> | <code>string[]</code> | File paths in the Docker directory to exclude from the build asset. |
|
|
487
|
+
| <code><a href="#token-injectable-docker-builder.TokenInjectableDockerBuilderProps.property.file">file</a></code> | <code>string</code> | Name of the Dockerfile (passed as `-f`). |
|
|
374
488
|
| <code><a href="#token-injectable-docker-builder.TokenInjectableDockerBuilderProps.property.installCommands">installCommands</a></code> | <code>string[]</code> | Custom commands to run during the install phase of CodeBuild. |
|
|
375
489
|
| <code><a href="#token-injectable-docker-builder.TokenInjectableDockerBuilderProps.property.kmsEncryption">kmsEncryption</a></code> | <code>boolean</code> | Whether to enable KMS encryption for the ECR repository. |
|
|
376
|
-
| <code><a href="#token-injectable-docker-builder.TokenInjectableDockerBuilderProps.property.maxImageCount">maxImageCount</a></code> | <code>number</code> | Maximum number of tagged images to retain in the ECR repository. |
|
|
377
490
|
| <code><a href="#token-injectable-docker-builder.TokenInjectableDockerBuilderProps.property.platform">platform</a></code> | <code>string</code> | Target platform for the Docker image. |
|
|
378
491
|
| <code><a href="#token-injectable-docker-builder.TokenInjectableDockerBuilderProps.property.preBuildCommands">preBuildCommands</a></code> | <code>string[]</code> | Custom commands to run during the pre_build phase of CodeBuild. |
|
|
379
492
|
| <code><a href="#token-injectable-docker-builder.TokenInjectableDockerBuilderProps.property.provider">provider</a></code> | <code><a href="#token-injectable-docker-builder.TokenInjectableDockerBuilderProvider">TokenInjectableDockerBuilderProvider</a></code> | Shared provider for the custom resource Lambdas. |
|
|
493
|
+
| <code><a href="#token-injectable-docker-builder.TokenInjectableDockerBuilderProps.property.replicaRegions">replicaRegions</a></code> | <code>string[]</code> | Additional AWS regions to replicate the built image to via ECR's native registry replication. |
|
|
380
494
|
| <code><a href="#token-injectable-docker-builder.TokenInjectableDockerBuilderProps.property.retainBuildLogs">retainBuildLogs</a></code> | <code>boolean</code> | When `true`, creates a CloudWatch log group outside of CloudFormation (`/docker-builder/<projectName>`) and directs CodeBuild output there. |
|
|
381
|
-
| <code><a href="#token-injectable-docker-builder.TokenInjectableDockerBuilderProps.property.securityGroups">securityGroups</a></code> | <code>aws-cdk-lib.aws_ec2.ISecurityGroup[]</code> |
|
|
382
|
-
| <code><a href="#token-injectable-docker-builder.TokenInjectableDockerBuilderProps.property.subnetSelection">subnetSelection</a></code> | <code>aws-cdk-lib.aws_ec2.SubnetSelection</code> |
|
|
495
|
+
| <code><a href="#token-injectable-docker-builder.TokenInjectableDockerBuilderProps.property.securityGroups">securityGroups</a></code> | <code>aws-cdk-lib.aws_ec2.ISecurityGroup[]</code> | Security groups attached to the CodeBuild project. |
|
|
496
|
+
| <code><a href="#token-injectable-docker-builder.TokenInjectableDockerBuilderProps.property.subnetSelection">subnetSelection</a></code> | <code>aws-cdk-lib.aws_ec2.SubnetSelection</code> | Subnet selection within the VPC. |
|
|
383
497
|
| <code><a href="#token-injectable-docker-builder.TokenInjectableDockerBuilderProps.property.vpc">vpc</a></code> | <code>aws-cdk-lib.aws_ec2.IVpc</code> | The VPC in which the CodeBuild project will be deployed. |
|
|
384
498
|
|
|
385
499
|
---
|
|
@@ -427,13 +541,10 @@ public readonly buildLogGroup: ILogGroup;
|
|
|
427
541
|
```
|
|
428
542
|
|
|
429
543
|
- *Type:* aws-cdk-lib.aws_logs.ILogGroup
|
|
430
|
-
- *Default:* CodeBuild default logging
|
|
544
|
+
- *Default:* CodeBuild default logging.
|
|
431
545
|
|
|
432
546
|
CloudWatch log group for CodeBuild build logs.
|
|
433
547
|
|
|
434
|
-
When provided with a RETAIN removal policy, build logs survive rollbacks
|
|
435
|
-
and stack deletion for debugging.
|
|
436
|
-
|
|
437
548
|
---
|
|
438
549
|
|
|
439
550
|
##### `cacheDisabled`<sup>Optional</sup> <a name="cacheDisabled" id="token-injectable-docker-builder.TokenInjectableDockerBuilderProps.property.cacheDisabled"></a>
|
|
@@ -447,24 +558,6 @@ public readonly cacheDisabled: boolean;
|
|
|
447
558
|
|
|
448
559
|
When `true`, disables Docker layer caching.
|
|
449
560
|
|
|
450
|
-
Every build runs from scratch.
|
|
451
|
-
Use for debugging, corrupted cache, or major dependency changes.
|
|
452
|
-
|
|
453
|
-
---
|
|
454
|
-
|
|
455
|
-
##### `completenessQueryInterval`<sup>Optional</sup> <a name="completenessQueryInterval" id="token-injectable-docker-builder.TokenInjectableDockerBuilderProps.property.completenessQueryInterval"></a>
|
|
456
|
-
|
|
457
|
-
```typescript
|
|
458
|
-
public readonly completenessQueryInterval: Duration;
|
|
459
|
-
```
|
|
460
|
-
|
|
461
|
-
- *Type:* aws-cdk-lib.Duration
|
|
462
|
-
- *Default:* Duration.seconds(30)
|
|
463
|
-
|
|
464
|
-
The query interval for checking if the CodeBuild project has completed.
|
|
465
|
-
|
|
466
|
-
This determines how frequently the custom resource polls for build completion.
|
|
467
|
-
|
|
468
561
|
---
|
|
469
562
|
|
|
470
563
|
##### `dockerLoginSecretArn`<sup>Optional</sup> <a name="dockerLoginSecretArn" id="token-injectable-docker-builder.TokenInjectableDockerBuilderProps.property.dockerLoginSecretArn"></a>
|
|
@@ -474,29 +567,15 @@ public readonly dockerLoginSecretArn: string;
|
|
|
474
567
|
```
|
|
475
568
|
|
|
476
569
|
- *Type:* string
|
|
570
|
+
- *Default:* No Docker Hub login.
|
|
477
571
|
|
|
478
572
|
The ARN of the AWS Secrets Manager secret containing Docker login credentials.
|
|
479
573
|
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
{
|
|
483
|
-
"username": "my-docker-username",
|
|
484
|
-
"password": "my-docker-password"
|
|
485
|
-
}
|
|
486
|
-
```
|
|
487
|
-
If not provided (or not needed), the construct will skip Docker Hub login.
|
|
488
|
-
|
|
489
|
-
**Note**: The secret must be in the same region as the stack.
|
|
574
|
+
The secret must store a JSON object: `{"username":"...","password":"..."}`.
|
|
575
|
+
Must be in the same region as the stack.
|
|
490
576
|
|
|
491
577
|
---
|
|
492
578
|
|
|
493
|
-
*Example*
|
|
494
|
-
|
|
495
|
-
```typescript
|
|
496
|
-
'arn:aws:secretsmanager:us-east-1:123456789012:secret:DockerLoginSecret'
|
|
497
|
-
```
|
|
498
|
-
|
|
499
|
-
|
|
500
579
|
##### `ecrPullThroughCachePrefixes`<sup>Optional</sup> <a name="ecrPullThroughCachePrefixes" id="token-injectable-docker-builder.TokenInjectableDockerBuilderProps.property.ecrPullThroughCachePrefixes"></a>
|
|
501
580
|
|
|
502
581
|
```typescript
|
|
@@ -504,15 +583,10 @@ public readonly ecrPullThroughCachePrefixes: string[];
|
|
|
504
583
|
```
|
|
505
584
|
|
|
506
585
|
- *Type:* string[]
|
|
507
|
-
- *Default:* No pull-through cache access
|
|
586
|
+
- *Default:* No pull-through cache access.
|
|
508
587
|
|
|
509
588
|
ECR pull-through cache repository prefixes to grant pull access to.
|
|
510
589
|
|
|
511
|
-
Use when your Dockerfile references base images from ECR pull-through
|
|
512
|
-
cache (e.g. docker-hub/library/node:20-slim, ghcr/org/image:tag).
|
|
513
|
-
The CodeBuild role will be granted ecr:BatchGetImage, ecr:GetDownloadUrlForLayer,
|
|
514
|
-
and ecr:BatchCheckLayerAvailability on repositories matching each prefix.
|
|
515
|
-
|
|
516
590
|
---
|
|
517
591
|
|
|
518
592
|
*Example*
|
|
@@ -529,11 +603,11 @@ public readonly exclude: string[];
|
|
|
529
603
|
```
|
|
530
604
|
|
|
531
605
|
- *Type:* string[]
|
|
532
|
-
- *Default:* No file path exclusions
|
|
606
|
+
- *Default:* No file path exclusions.
|
|
533
607
|
|
|
534
|
-
|
|
608
|
+
File paths in the Docker directory to exclude from the build asset.
|
|
535
609
|
|
|
536
|
-
|
|
610
|
+
Falls back to `.dockerignore` if present.
|
|
537
611
|
|
|
538
612
|
---
|
|
539
613
|
|
|
@@ -546,9 +620,7 @@ public readonly file: string;
|
|
|
546
620
|
- *Type:* string
|
|
547
621
|
- *Default:* 'Dockerfile'
|
|
548
622
|
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
Passed as `--file` to `docker build`.
|
|
623
|
+
Name of the Dockerfile (passed as `-f`).
|
|
552
624
|
|
|
553
625
|
---
|
|
554
626
|
|
|
@@ -570,16 +642,6 @@ public readonly installCommands: string[];
|
|
|
570
642
|
|
|
571
643
|
Custom commands to run during the install phase of CodeBuild.
|
|
572
644
|
|
|
573
|
-
**Example**:
|
|
574
|
-
```ts
|
|
575
|
-
installCommands: [
|
|
576
|
-
'echo "Updating package lists..."',
|
|
577
|
-
'apt-get update -y',
|
|
578
|
-
'echo "Installing required packages..."',
|
|
579
|
-
'apt-get install -y curl dnsutils',
|
|
580
|
-
],
|
|
581
|
-
```
|
|
582
|
-
|
|
583
645
|
---
|
|
584
646
|
|
|
585
647
|
##### `kmsEncryption`<sup>Optional</sup> <a name="kmsEncryption" id="token-injectable-docker-builder.TokenInjectableDockerBuilderProps.property.kmsEncryption"></a>
|
|
@@ -593,30 +655,6 @@ public readonly kmsEncryption: boolean;
|
|
|
593
655
|
|
|
594
656
|
Whether to enable KMS encryption for the ECR repository.
|
|
595
657
|
|
|
596
|
-
If `true`, a KMS key will be created for encrypting ECR images.
|
|
597
|
-
If `false`, the repository will use AES-256 encryption.
|
|
598
|
-
|
|
599
|
-
---
|
|
600
|
-
|
|
601
|
-
##### `maxImageCount`<sup>Optional</sup> <a name="maxImageCount" id="token-injectable-docker-builder.TokenInjectableDockerBuilderProps.property.maxImageCount"></a>
|
|
602
|
-
|
|
603
|
-
```typescript
|
|
604
|
-
public readonly maxImageCount: number;
|
|
605
|
-
```
|
|
606
|
-
|
|
607
|
-
- *Type:* number
|
|
608
|
-
- *Default:* undefined - no count-based expiration; only untagged-after-30-days
|
|
609
|
-
|
|
610
|
-
Maximum number of tagged images to retain in the ECR repository.
|
|
611
|
-
|
|
612
|
-
**WARNING:** Lambda functions pin images by digest internally even when
|
|
613
|
-
referenced by tag. Setting this can delete images that Lambda functions
|
|
614
|
-
(and ECS tasks) are still pinned to, breaking the next configuration
|
|
615
|
-
update with "Image ID cannot be found".
|
|
616
|
-
|
|
617
|
-
Leave undefined (the default) for production use. Untagged images are
|
|
618
|
-
always cleaned up after 30 days regardless of this setting.
|
|
619
|
-
|
|
620
658
|
---
|
|
621
659
|
|
|
622
660
|
##### `platform`<sup>Optional</sup> <a name="platform" id="token-injectable-docker-builder.TokenInjectableDockerBuilderProps.property.platform"></a>
|
|
@@ -630,9 +668,6 @@ public readonly platform: string;
|
|
|
630
668
|
|
|
631
669
|
Target platform for the Docker image.
|
|
632
670
|
|
|
633
|
-
When set to `'linux/arm64'`, the construct uses a native ARM/Graviton
|
|
634
|
-
CodeBuild instance for fast builds without emulation.
|
|
635
|
-
|
|
636
671
|
---
|
|
637
672
|
|
|
638
673
|
##### `preBuildCommands`<sup>Optional</sup> <a name="preBuildCommands" id="token-injectable-docker-builder.TokenInjectableDockerBuilderProps.property.preBuildCommands"></a>
|
|
@@ -646,14 +681,6 @@ public readonly preBuildCommands: string[];
|
|
|
646
681
|
|
|
647
682
|
Custom commands to run during the pre_build phase of CodeBuild.
|
|
648
683
|
|
|
649
|
-
**Example**:
|
|
650
|
-
```ts
|
|
651
|
-
preBuildCommands: [
|
|
652
|
-
'echo "Fetching configuration from private API..."',
|
|
653
|
-
'curl -o config.json https://api.example.com/config',
|
|
654
|
-
],
|
|
655
|
-
```
|
|
656
|
-
|
|
657
684
|
---
|
|
658
685
|
|
|
659
686
|
##### `provider`<sup>Optional</sup> <a name="provider" id="token-injectable-docker-builder.TokenInjectableDockerBuilderProps.property.provider"></a>
|
|
@@ -663,17 +690,60 @@ public readonly provider: TokenInjectableDockerBuilderProvider;
|
|
|
663
690
|
```
|
|
664
691
|
|
|
665
692
|
- *Type:* <a href="#token-injectable-docker-builder.TokenInjectableDockerBuilderProvider">TokenInjectableDockerBuilderProvider</a>
|
|
666
|
-
- *Default:*
|
|
693
|
+
- *Default:* Per-stack singleton provider, created on first use.
|
|
667
694
|
|
|
668
695
|
Shared provider for the custom resource Lambdas.
|
|
669
696
|
|
|
670
|
-
|
|
671
|
-
|
|
697
|
+
Pass `TokenInjectableDockerBuilderProvider.getOrCreate(this, { queryInterval })`
|
|
698
|
+
if you need a non-default query interval. Otherwise, the construct will
|
|
699
|
+
call `getOrCreate(this)` itself and reuse the per-stack singleton.
|
|
700
|
+
|
|
701
|
+
---
|
|
702
|
+
|
|
703
|
+
##### `replicaRegions`<sup>Optional</sup> <a name="replicaRegions" id="token-injectable-docker-builder.TokenInjectableDockerBuilderProps.property.replicaRegions"></a>
|
|
704
|
+
|
|
705
|
+
```typescript
|
|
706
|
+
public readonly replicaRegions: string[];
|
|
707
|
+
```
|
|
708
|
+
|
|
709
|
+
- *Type:* string[]
|
|
710
|
+
- *Default:* [] - no replication
|
|
711
|
+
|
|
712
|
+
Additional AWS regions to replicate the built image to via ECR's native registry replication.
|
|
672
713
|
|
|
673
|
-
|
|
714
|
+
The image is pushed to the primary
|
|
715
|
+
region's ECR as usual; ECR asynchronously replicates the same
|
|
716
|
+
`repositoryName` + `imageTag` to each region listed here.
|
|
717
|
+
|
|
718
|
+
Consumers in another region (a Lambda in `us-west-2` referencing an
|
|
719
|
+
image built in `us-east-1`) can use `dockerImageCodeFor(region)` or
|
|
720
|
+
`containerImageFor(region)` to import the replicated image.
|
|
721
|
+
|
|
722
|
+
The custom resource waits for replication to complete before
|
|
723
|
+
signalling deploy-complete, so downstream stacks can safely deploy
|
|
724
|
+
immediately after.
|
|
725
|
+
|
|
726
|
+
**Caveats:**
|
|
727
|
+
- Cross-region replication is not supported between AWS partitions.
|
|
728
|
+
- Replicas do **not** inherit the primary's encryption (defaults to
|
|
729
|
+
AES-256), lifecycle policies, or repository policies.
|
|
730
|
+
- Replicated repositories persist on stack deletion — AWS does not
|
|
731
|
+
auto-delete them. Clean up manually via the ECR console / CLI if
|
|
732
|
+
needed.
|
|
733
|
+
- Both the builder stack and any consumer stack in another region
|
|
734
|
+
must set `crossRegionReferences: true` for the image tag to flow.
|
|
735
|
+
- Stacks must have a concrete region (`env: { account, region }`),
|
|
736
|
+
not the env-agnostic default.
|
|
674
737
|
|
|
675
738
|
---
|
|
676
739
|
|
|
740
|
+
*Example*
|
|
741
|
+
|
|
742
|
+
```typescript
|
|
743
|
+
['us-west-2', 'eu-west-1']
|
|
744
|
+
```
|
|
745
|
+
|
|
746
|
+
|
|
677
747
|
##### `retainBuildLogs`<sup>Optional</sup> <a name="retainBuildLogs" id="token-injectable-docker-builder.TokenInjectableDockerBuilderProps.property.retainBuildLogs"></a>
|
|
678
748
|
|
|
679
749
|
```typescript
|
|
@@ -685,11 +755,7 @@ public readonly retainBuildLogs: boolean;
|
|
|
685
755
|
|
|
686
756
|
When `true`, creates a CloudWatch log group outside of CloudFormation (`/docker-builder/<projectName>`) and directs CodeBuild output there.
|
|
687
757
|
|
|
688
|
-
|
|
689
|
-
it survives stack rollbacks and preserves full build logs for debugging.
|
|
690
|
-
A 7-day retention policy is applied so old logs auto-expire.
|
|
691
|
-
|
|
692
|
-
Set to `false` after debugging to delete the log group and clean up.
|
|
758
|
+
Survives stack rollbacks for debugging. 7-day retention.
|
|
693
759
|
|
|
694
760
|
---
|
|
695
761
|
|
|
@@ -700,11 +766,9 @@ public readonly securityGroups: ISecurityGroup[];
|
|
|
700
766
|
```
|
|
701
767
|
|
|
702
768
|
- *Type:* aws-cdk-lib.aws_ec2.ISecurityGroup[]
|
|
703
|
-
- *Default:* No security groups
|
|
704
|
-
|
|
705
|
-
The security groups to attach to the CodeBuild project.
|
|
769
|
+
- *Default:* No security groups attached.
|
|
706
770
|
|
|
707
|
-
|
|
771
|
+
Security groups attached to the CodeBuild project.
|
|
708
772
|
|
|
709
773
|
---
|
|
710
774
|
|
|
@@ -715,11 +779,9 @@ public readonly subnetSelection: SubnetSelection;
|
|
|
715
779
|
```
|
|
716
780
|
|
|
717
781
|
- *Type:* aws-cdk-lib.aws_ec2.SubnetSelection
|
|
718
|
-
- *Default:* All subnets in the VPC
|
|
782
|
+
- *Default:* All subnets in the VPC.
|
|
719
783
|
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
Allows the user to select private, public, or isolated subnets.
|
|
784
|
+
Subnet selection within the VPC.
|
|
723
785
|
|
|
724
786
|
---
|
|
725
787
|
|
|
@@ -730,12 +792,10 @@ public readonly vpc: IVpc;
|
|
|
730
792
|
```
|
|
731
793
|
|
|
732
794
|
- *Type:* aws-cdk-lib.aws_ec2.IVpc
|
|
733
|
-
- *Default:*
|
|
795
|
+
- *Default:* CodeBuild uses public internet.
|
|
734
796
|
|
|
735
797
|
The VPC in which the CodeBuild project will be deployed.
|
|
736
798
|
|
|
737
|
-
If provided, the CodeBuild project will be launched within the specified VPC.
|
|
738
|
-
|
|
739
799
|
---
|
|
740
800
|
|
|
741
801
|
### TokenInjectableDockerBuilderProviderProps <a name="TokenInjectableDockerBuilderProviderProps" id="token-injectable-docker-builder.TokenInjectableDockerBuilderProviderProps"></a>
|