LocalCacheMode Enum
Local cache modes to enable for the CodeBuild Project.
Example
ts
new codebuild.Project(this, 'Project', {
source: codebuild.Source.gitHubEnterprise({
httpsCloneUrl: 'https://my-github-enterprise.com/owner/repo',
}),
// Enable Docker AND custom caching
cache: codebuild.Cache.local(codebuild.LocalCacheMode.DOCKER_LAYER, codebuild.LocalCacheMode.CUSTOM),
// BuildSpec with a 'cache' section necessary for 'CUSTOM' caching. This can
// also come from 'buildspec.yml' in your source.
buildSpec: codebuild.BuildSpec.fromObject({
version: '0.2',
phases: {
build: {
commands: ['...'],
},
},
cache: {
paths: [
// The '**/*' is required to indicate all files in this directory
'/root/cachedir/**/*',
],
},
}),
});
Members
| Member | Description |
|---|---|
SOURCE | Caches Git metadata for primary and secondary sources. |
DOCKER_LAYER | Caches existing Docker layers. |
CUSTOM | Caches directories you specify in the buildspec file. |