How to use the @aws-cdk/aws-codebuild.Cache function in @aws-cdk/aws-codebuild

To help you get started, we’ve selected a few @aws-cdk/aws-codebuild examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github humank / EventStormingWorkShop / deployment / coffeeshop-cdk / lib / coffee-shop-code-pipeline.ts View on Github external
// the new bucket, and it will remain in your account until manually deleted. By setting the policy to
            // DESTROY, cdk destroy will attempt to delete the bucket, but will error if the bucket is not empty.

            //removalPolicy: cdk.RemovalPolicy.DESTROY, // NOT recommended for production code
        });

        coffeeShopBucket.grantPut(buildRole);
        coffeeShopBucket.grantRead(buildRole);
        coffeeShopBucket.grantReadWrite(buildRole);
        coffeeShopBucket.grantWrite(buildRole);

        new codebuild.Project(this, 'CodeBuildProject', {
            role: buildRole,
            source: defaultSource,
            // Enable Docker AND custom caching
            cache: codebuild.Cache.local(codebuild.LocalCacheMode.DOCKER_LAYER, codebuild.LocalCacheMode.CUSTOM),
            environment: {
                buildImage: codebuild.LinuxBuildImage.AMAZON_LINUX_2,
                privileged: true,
            },
            buildSpec: codebuild.BuildSpec.fromObject({
                version: '0.2',
                phases: {
                    install:{
                        'runtime-versions': {
                            java: 'corretto8'
                        }
                    },
                    build: {
                        commands: [
                            'echo "Build all modules"',
                            'echo "Run Maven clean install to have all the required jars in local .m2 repository"',