Skip to content
v2.273.0

MacBuildImage Class ​

A CodeBuild image running ARM MacOS.

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:

  • MacBuildImage.fromDockerRegistry(image[, { secretsManagerCredentials }])
  • MacBuildImage.fromEcrRepository(repo[, tag])
  • MacBuildImage.fromAsset(parent, id, props)

Example ​

ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import * as cdk from 'aws-cdk-lib';
import { aws_codebuild as codebuild } from 'aws-cdk-lib';
import { aws_ecr_assets as ecr_assets } from 'aws-cdk-lib';

declare const networkMode: ecr_assets.NetworkMode;
declare const platform: ecr_assets.Platform;
const macBuildImage = codebuild.MacBuildImage.fromAsset(this, 'MyMacBuildImage', {
  directory: 'directory',

  // the properties below are optional
  assetName: 'assetName',
  buildArgs: {
    buildArgsKey: 'buildArgs',
  },
  buildContexts: {
    buildContextsKey: 'buildContexts',
  },
  buildSecrets: {
    buildSecretsKey: 'buildSecrets',
  },
  buildSsh: 'buildSsh',
  cacheDisabled: false,
  cacheFrom: [{
    type: 'type',

    // the properties below are optional
    params: {
      paramsKey: 'params',
    },
  }],
  cacheTo: {
    type: 'type',

    // the properties below are optional
    params: {
      paramsKey: 'params',
    },
  },
  displayName: 'displayName',
  exclude: ['exclude'],
  extraHash: 'extraHash',
  file: 'file',
  followSymlinks: cdk.SymlinkFollowMode.NEVER,
  ignoreMode: cdk.IgnoreMode.GLOB,
  invalidation: {
    buildArgs: false,
    buildContexts: false,
    buildSecrets: false,
    buildSsh: false,
    extraHash: false,
    file: false,
    networkMode: false,
    outputs: false,
    platform: false,
    repositoryName: false,
    target: false,
  },
  networkMode: networkMode,
  outputs: ['outputs'],
  platform: platform,
  target: 'target',
});

Properties ​

BASE_14IBuildImagebase_14IBuildImageBASE_14IBuildImageBASE_14IBuildImageBASE_14IBuildImagerequiredstatic#
Corresponds to the standard CodeBuild image `aws/codebuild/macos-arm-base:14`.
BASE_15IBuildImagebase_15IBuildImageBASE_15IBuildImageBASE_15IBuildImageBASE_15IBuildImagerequiredstatic#
Corresponds to the CodeBuild image `aws/codebuild/macos-arm-base:15`.
BASE_26IBuildImagebase_26IBuildImageBASE_26IBuildImageBASE_26IBuildImageBASE_26IBuildImagerequiredstatic#
Corresponds to the CodeBuild image `aws/codebuild/macos-arm-base:26`.
defaultComputeTypeComputeTypedefault_compute_typeComputeTypedefaultComputeTypeComputeTypeDefaultComputeTypeComputeTypeDefaultComputeTypeComputeTyperequired#
The default `ComputeType` to use with this image, if one was not specified in `BuildEnvironment#computeType` explicitly.
imageIdstringimage_idstrimageIdStringImageIdstringImageId*stringrequired#
The Docker image identifier that the build environment uses.
imagePullPrincipalTypeImagePullPrincipalTypeimage_pull_principal_typeImagePullPrincipalTypeimagePullPrincipalTypeImagePullPrincipalTypeImagePullPrincipalTypeImagePullPrincipalTypeImagePullPrincipalTypeImagePullPrincipalType#
The type of principal that CodeBuild will use to pull this build Docker image.
repositoryIRepositoryrepositoryIRepositoryrepositoryIRepositoryRepositoryIRepositoryRepositoryIRepository#
An optional ECR repository that the image is hosted in.
secretsManagerCredentialsISecretsecrets_manager_credentialsISecretsecretsManagerCredentialsISecretSecretsManagerCredentialsISecretSecretsManagerCredentialsISecret#
The secretsManagerCredentials for access to a private registry.
typestringtypestrtypeStringTypestringType*stringrequired#
The type of build environment.

Methods ​

fromAsset(scope: Construct, id: string, props: DockerImageAssetProps): IBuildImage@staticmethod def from_asset(scope: Construct, id: str, props: DockerImageAssetProps) -> IBuildImagepublic static IBuildImage fromAsset(Construct scope, String id, DockerImageAssetProps props)public static IBuildImage FromAsset(Construct scope, string id, DockerImageAssetProps props)func FromAsset(Scope Construct, Id *string, Props DockerImageAssetProps) IBuildImagestatic#
Uses an Docker image asset as a ARM MacOS build image.
fromDockerRegistry(name: string, options?: DockerImageOptions): IBuildImage@staticmethod def from_docker_registry(name: str, options: typing.Optional[DockerImageOptions] = None) -> IBuildImagepublic static IBuildImage fromDockerRegistry(String name, DockerImageOptions options)public static IBuildImage FromDockerRegistry(string name, DockerImageOptions? options = null)func FromDockerRegistry(Name *string, Options DockerImageOptions) IBuildImagestatic#
Makes an ARM MacOS build image from a Docker Hub image.
fromEcrRepository(repository: IRepository, tagOrDigest?: string): IBuildImage@staticmethod def from_ecr_repository(repository: IRepository, tag_or_digest: typing.Optional[str] = None) -> IBuildImagepublic static IBuildImage fromEcrRepository(IRepository repository, String tagOrDigest)public static IBuildImage FromEcrRepository(IRepository repository, string? tagOrDigest = null)func FromEcrRepository(Repository IRepository, TagOrDigest *string) IBuildImagestatic#
Makes an ARM MacOS build image from an ECR repository.
runScriptBuildspec(entrypoint: string): BuildSpecdef run_script_buildspec(self, entrypoint: str) -> BuildSpecpublic BuildSpec runScriptBuildspec(String entrypoint)public BuildSpec RunScriptBuildspec(string entrypoint)func RunScriptBuildspec(Entrypoint *string) BuildSpec#
Make a buildspec to run the indicated script.
validate(buildEnvironment: BuildEnvironment): string[]def validate(self, build_environment: BuildEnvironment) -> typing.List[str]public List<String> validate(BuildEnvironment buildEnvironment)public string[] Validate(BuildEnvironment buildEnvironment)func Validate(BuildEnvironment BuildEnvironment) *[]*string#
Allows the image a chance to validate whether the passed configuration is correct.