DockerServerOptions

class aws_cdk.aws_codebuild.DockerServerOptions(*, compute_type, security_groups=None)

Bases: object

The Docker server configuration CodeBuild use to build your Docker image.

Parameters:
  • compute_type (DockerServerComputeType) – The type of compute to use for the docker server. See the DockerServerComputeType enum for the possible values.

  • security_groups (Optional[Sequence[ISecurityGroup]]) – A list of maximum 5 security groups. Default: - no security group

ExampleMetadata:

infused

Example:

# vpc: ec2.Vpc
# my_security_group: ec2.SecurityGroup

pipelines.CodeBuildStep("Synth",
    # ...standard ShellStep props...
    commands=[],
    env={},

    # If you are using a CodeBuildStep explicitly, set the 'cdk.out' directory
    # to be the synth step's output.
    primary_output_directory="cdk.out",

    # Control the name of the project
    project_name="MyProject",

    # Control parts of the BuildSpec other than the regular 'build' and 'install' commands
    partial_build_spec=codebuild.BuildSpec.from_object({
        "version": "0.2"
    }),

    # Control the build environment
    build_environment=codebuild.BuildEnvironment(
        compute_type=codebuild.ComputeType.LARGE,
        privileged=True,
        docker_server=codebuild.DockerServerOptions(
            compute_type=codebuild.DockerServerComputeType.SMALL,
            security_groups=[my_security_group]
        )
    ),
    timeout=Duration.minutes(90),
    file_system_locations=[
        codebuild.FileSystemLocation.efs(
            identifier="myidentifier2",
            location="myclodation.mydnsroot.com:/loc",
            mount_point="/media",
            mount_options="opts"
        )
    ],

    # Control Elastic Network Interface creation
    vpc=vpc,
    subnet_selection=ec2.SubnetSelection(subnet_type=ec2.SubnetType.PRIVATE_WITH_EGRESS),
    security_groups=[my_security_group],

    # Control caching
    cache=codebuild.Cache.bucket(s3.Bucket(self, "Cache")),

    # Additional policy statements for the execution role
    role_policy_statements=[
        iam.PolicyStatement()
    ]
)

Attributes

compute_type

The type of compute to use for the docker server.

See the DockerServerComputeType enum for the possible values.

security_groups

A list of maximum 5 security groups.

Default:
  • no security group

Note:

Security groups configured for Docker servers should allow ingress network traffic from the VPC configured in the project. They should allow ingress on port 9876.