class LinuxBuildImage
Language | Type name |
---|---|
![]() | Amazon.CDK.AWS.CodeBuild.LinuxBuildImage |
![]() | github.com/aws/aws-cdk-go/awscdk/v2/awscodebuild#LinuxBuildImage |
![]() | software.amazon.awscdk.services.codebuild.LinuxBuildImage |
![]() | aws_cdk.aws_codebuild.LinuxBuildImage |
![]() | aws-cdk-lib » aws_codebuild » LinuxBuildImage |
Implements
IBuild
A CodeBuild image running x86-64 Linux.
This class has a bunch of public constants that represent the most popular images.
You can also specify a custom image using one of the static methods:
- LinuxBuildImage.fromDockerRegistry(image[, { secretsManagerCredentials }])
- LinuxBuildImage.fromEcrRepository(repo[, tag])
- LinuxBuildImage.fromAsset(parent, id, props)
Example
const pipeline = new pipelines.CodePipeline(this, 'Pipeline', {
synth: new pipelines.ShellStep('Synth', {
input: pipelines.CodePipelineSource.connection('my-org/my-app', 'main', {
connectionArn:
'arn:aws:codestar-connections:us-east-1:222222222222:connection/7d2469ff-514a-4e4f-9003-5ca4a43cdc41', // Created using the AWS console * });',
}),
commands: ['npm ci', 'npm run build', 'npx cdk synth'],
}),
// Turn this on because the pipeline uses Docker image assets
dockerEnabledForSelfMutation: true,
});
pipeline.addWave('MyWave', {
post: [
new pipelines.CodeBuildStep('RunApproval', {
commands: ['command-from-image'],
buildEnvironment: {
// The user of a Docker image asset in the pipeline requires turning on
// 'dockerEnabledForSelfMutation'.
buildImage: codebuild.LinuxBuildImage.fromAsset(this, 'Image', {
directory: './docker-image',
}),
},
}),
],
});
Properties
Name | Type | Description |
---|---|---|
default | Compute | The default ComputeType to use with this image, if one was not specified in BuildEnvironment#computeType explicitly. |
image | string | The Docker image identifier that the build environment uses. |
type | string | The type of build environment. |
image | Image | The type of principal that CodeBuild will use to pull this build Docker image. |
repository? | IRepository | An optional ECR repository that the image is hosted in. |
secrets | ISecret | The secretsManagerCredentials for access to a private registry. |
static AMAZON_LINUX_2 | IBuild | |
static AMAZON_LINUX_2023_4 | IBuild | The Amazon Linux 2023 x86_64 standard image, version 4.0 . |
static AMAZON_LINUX_2023_5 | IBuild | The Amazon Linux 2023 x86_64 standard image, version 5.0 . |
static AMAZON_LINUX_2023_CORETTO_11 | IBuild | The Amazon Coretto 11 image x86_64, based on Amazon Linux 2023. |
static AMAZON_LINUX_2023_CORETTO_8 | IBuild | The Amazon Coretto 8 image x86_64, based on Amazon Linux 2023. |
static AMAZON_LINUX_2_2 | IBuild | |
static AMAZON_LINUX_2_3 | IBuild | The Amazon Linux 2 x86_64 standard image, version 3.0 . |
static AMAZON_LINUX_2_4 | IBuild | The Amazon Linux 2 x86_64 standard image, version 4.0 . |
static AMAZON_LINUX_2_5 | IBuild | The Amazon Linux 2023 x86_64 standard image, version 5.0 . |
static AMAZON_LINUX_2_ARM | IBuild | Image "aws/codebuild/amazonlinux2-aarch64-standard:1.0". |
static AMAZON_LINUX_2_ARM_2 | IBuild | Image "aws/codebuild/amazonlinux2-aarch64-standard:2.0". |
static AMAZON_LINUX_2_ARM_3 | IBuild | Image "aws/codebuild/amazonlinux2-aarch64-standard:3.0". |
static AMAZON_LINUX_2_CORETTO_11 | IBuild | The Amazon Coretto 11 image x86_64, based on Amazon Linux 2. |
static AMAZON_LINUX_2_CORETTO_8 | IBuild | The Amazon Coretto 8 image x86_64, based on Amazon Linux 2. |
static STANDARD_1_0 | IBuild | |
static STANDARD_2_0 | IBuild | |
static STANDARD_3_0 | IBuild | |
static STANDARD_4_0 | IBuild | The aws/codebuild/standard:4.0 build image. |
static STANDARD_5_0 | IBuild | The aws/codebuild/standard:5.0 build image. |
static STANDARD_6_0 | IBuild | The aws/codebuild/standard:6.0 build image. |
static STANDARD_7_0 | IBuild | The aws/codebuild/standard:7.0 build image. |
defaultComputeType
Type:
Compute
The default ComputeType
to use with this image, if one was not specified in BuildEnvironment#computeType
explicitly.
imageId
Type:
string
The Docker image identifier that the build environment uses.
type
Type:
string
The type of build environment.
imagePullPrincipalType?
Type:
Image
(optional)
The type of principal that CodeBuild will use to pull this build Docker image.
repository?
Type:
IRepository
(optional)
An optional ECR repository that the image is hosted in.
secretsManagerCredentials?
Type:
ISecret
(optional)
The secretsManagerCredentials for access to a private registry.
static AMAZON_LINUX_2
⚠️ Deprecated: Use {@link LinuxBuildImage.AMAZON_LINUX_2_5 } instead.
Type:
IBuild
static AMAZON_LINUX_2023_4
Type:
IBuild
The Amazon Linux 2023 x86_64 standard image, version 4.0
.
static AMAZON_LINUX_2023_5
Type:
IBuild
The Amazon Linux 2023 x86_64 standard image, version 5.0
.
static AMAZON_LINUX_2023_CORETTO_11
Type:
IBuild
The Amazon Coretto 11 image x86_64, based on Amazon Linux 2023.
static AMAZON_LINUX_2023_CORETTO_8
Type:
IBuild
The Amazon Coretto 8 image x86_64, based on Amazon Linux 2023.
static AMAZON_LINUX_2_2
⚠️ Deprecated: Use {@link LinuxBuildImage.AMAZON_LINUX_2_5 } instead.
Type:
IBuild
static AMAZON_LINUX_2_3
⚠️ Deprecated: Use {@link LinuxBuildImage.AMAZON_LINUX_2_5 } instead.
Type:
IBuild
The Amazon Linux 2 x86_64 standard image, version 3.0
.
static AMAZON_LINUX_2_4
Type:
IBuild
The Amazon Linux 2 x86_64 standard image, version 4.0
.
static AMAZON_LINUX_2_5
Type:
IBuild
The Amazon Linux 2023 x86_64 standard image, version 5.0
.
static AMAZON_LINUX_2_ARM
⚠️ Deprecated: Use {@link LinuxArmBuildImage.AMAZON_LINUX_2_ARM_3 } instead.
Type:
IBuild
Image "aws/codebuild/amazonlinux2-aarch64-standard:1.0".
See also: {LinuxArmBuildImage.AMAZON_LINUX_2_STANDARD_1_0}
static AMAZON_LINUX_2_ARM_2
Type:
IBuild
Image "aws/codebuild/amazonlinux2-aarch64-standard:2.0".
See also: {LinuxArmBuildImage.AMAZON_LINUX_2_STANDARD_2_0}
static AMAZON_LINUX_2_ARM_3
Type:
IBuild
Image "aws/codebuild/amazonlinux2-aarch64-standard:3.0".
See also: {LinuxArmBuildImage.AMAZON_LINUX_2_STANDARD_3_0}
static AMAZON_LINUX_2_CORETTO_11
Type:
IBuild
The Amazon Coretto 11 image x86_64, based on Amazon Linux 2.
static AMAZON_LINUX_2_CORETTO_8
Type:
IBuild
The Amazon Coretto 8 image x86_64, based on Amazon Linux 2.
static STANDARD_1_0
⚠️ Deprecated: Use {@link LinuxBuildImage.STANDARD_7_0 } instead.
Type:
IBuild
static STANDARD_2_0
⚠️ Deprecated: Use {@link LinuxBuildImage.STANDARD_7_0 } instead.
Type:
IBuild
static STANDARD_3_0
⚠️ Deprecated: Use {@link LinuxBuildImage.STANDARD_7_0 } instead.
Type:
IBuild
static STANDARD_4_0
⚠️ Deprecated: Use {@link LinuxBuildImage.STANDARD_7_0 } instead.
Type:
IBuild
The aws/codebuild/standard:4.0
build image.
static STANDARD_5_0
Type:
IBuild
The aws/codebuild/standard:5.0
build image.
static STANDARD_6_0
Type:
IBuild
The aws/codebuild/standard:6.0
build image.
static STANDARD_7_0
Type:
IBuild
The aws/codebuild/standard:7.0
build image.
Methods
Name | Description |
---|---|
run | Make a buildspec to run the indicated script. |
validate(env) | Allows the image a chance to validate whether the passed configuration is correct. |
static from | Uses an Docker image asset as a x86-64 Linux build image. |
static from | Uses a Docker image provided by CodeBuild. |
static from | |
static from |
runScriptBuildspec(entrypoint)
public runScriptBuildspec(entrypoint: string): BuildSpec
Parameters
- entrypoint
string
Returns
Make a buildspec to run the indicated script.
validate(env)
public validate(env: BuildEnvironment): string[]
Parameters
- env
Build
Environment
Returns
string[]
Allows the image a chance to validate whether the passed configuration is correct.
static fromAsset(scope, id, props)
public static fromAsset(scope: Construct, id: string, props: DockerImageAssetProps): IBuildImage
Parameters
- scope
Construct
- id
string
- props
Docker
Image Asset Props
Returns
Uses an Docker image asset as a x86-64 Linux build image.
static fromCodeBuildImageId(id)
public static fromCodeBuildImageId(id: string): IBuildImage
Parameters
- id
string
— The image identifier.
Returns
Uses a Docker image provided by CodeBuild.
See also: https://docs.aws.amazon.com/codebuild/latest/userguide/build-env-ref-available.html Example
'aws/codebuild/standard:4.0'
static fromDockerRegistry(name, options?)
public static fromDockerRegistry(name: string, options?: DockerImageOptions): IBuildImage
Parameters
- name
string
- options
Docker
Image Options
Returns
static fromEcrRepository(repository, tagOrDigest?)
public static fromEcrRepository(repository: IRepository, tagOrDigest?: string): IBuildImage
Parameters
- repository
IRepository
— The ECR repository. - tagOrDigest
string
— Image tag or digest (default "latest", digests must start withsha256:
).
Returns
See also: https://docs.aws.amazon.com/codebuild/latest/userguide/sample-ecr.html