-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Improve docker build time in CI environment #1748
Copy link
Copy link
Closed
Labels
@aws-cdk/aws-ecsRelated to Amazon Elastic ContainerRelated to Amazon Elastic Containerfeature-requestA feature should be added or improved.A feature should be added or improved.package/toolsRelated to AWS CDK Tools or CLIRelated to AWS CDK Tools or CLI
Description
Hello,
In a CI environment where no layer cache are available, docker builds of ECS tasks can take a very long time.
A classic solution for this is to pull first the latest image from the registry and use it as an input for the --cache-from argument of docker build (see here aws/aws-codebuild-docker-images#26 (comment) and https://medium.com/@gajus/making-docker-in-docker-builds-x2-faster-using-docker-cache-from-option-c01febd8ef84).
This implies the following changes in prepareContainerAsset:
- In addition to tagging the image with the
calculateImageFingerprint, tag withlatest - When in CI (detected by something like
process.env.CI) try to pulllatestfirst and then build with--cache-from
(toolkitInfo.prepareEcrRepository should also be refactored/splitted in order to get the repostoryUri sooner/without having to pass a tag)
I would be interested to have aws-cdk's team opinion on this.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
@aws-cdk/aws-ecsRelated to Amazon Elastic ContainerRelated to Amazon Elastic Containerfeature-requestA feature should be added or improved.A feature should be added or improved.package/toolsRelated to AWS CDK Tools or CLIRelated to AWS CDK Tools or CLI