Duncan McGregor
Duncan McGregor

Reputation: 18157

Is there any way to cache build dependencies using AWS CodeBuild?

Between 1 and 2 minutes of my AWS CodeBuilds are spent downloading dependencies from Maven Central.

Short of building a pre-provisioned Docker container, is there any way to cache these between builds?

Upvotes: 11

Views: 10330

Answers (2)

Justin Rice
Justin Rice

Reputation: 1301

Unsigned's answer is good but is a tad outdated. As of February 2019, CodeBuild allows both caching in an S3 bucket and allows the user to cache locally. You can now specify cache at 3 different layers of a build:

  • Docker Layer Caching
  • Git Layer Cahing (cache the last build and then only build from git diff)
  • Custom caching - specified within the cache: portion of your buildspec.yml file. Personally, I cache my node_modules/ here and then cache at the Git Layer.

Source: https://aws.amazon.com/blogs/devops/improve-build-performance-and-save-time-using-local-caching-in-aws-codebuild/

Upvotes: 7

Unsigned
Unsigned

Reputation: 9916

CodeBuild now provides a cache feature you can use to pre-load your dependencies.

Upvotes: 15

Related Questions