- 最新
- 最多得票
- 最多評論
Hi Dan, CodeBuild now supports custom image for Lambda Compute: https://aws.amazon.com/about-aws/whats-new/2024/03/aws-codebuild-custom-images-lambda-compute/. You can pre-install extra runtimes into your custom image and use that in CodeBuild, thanks.
It is possible to install multiple runtimes and tools on CodeBuild's Lambda compute type, but it requires some additional scripting and packaging compared to the managed images. Here are a couple options:
-
Create a custom Lambda layer that contains all the runtimes and tools you need, and reference that layer in your CodeBuild project. The layer can include binaries for Node, Java, .NET, etc. as well as any CLI tools.
-
Use the CodeBuild pre-build phase to run a script that downloads and installs the required runtimes and tools into the /opt folder. Then zip up the /opt folder and use it as the primary source for the build phase.
-
Create a Docker image with all the tools and runtimes pre-installed, upload to ECR, and use that for your CodeBuild environment image. More complex but gives you full control.
The key considerations are:
-
Everything must be contained in the /opt folder which persists between builds. Can't install globally.
-
Scripts and binaries have to be packaged up or layered in. Can't rely on yum/apt.
-
Need to be careful of file permissions and access without root.
So it's definitely possible but requires more custom setup than managed images. Let me know if you have any other questions!
相關內容
- 已提問 6 個月前
- AWS 官方已更新 1 年前
Thanks for the quick response, I've been a bit distracted this week with other fires to put out... Following up, I haven't seen any documentation regarding custom layers on CodeBuild Lambda compute... Last I read, I've seen no mention of layers/custom images being used for CodeBuild's lambda, so both options #1 and #3 are confusing me.
Regarding #2, is there an example of using CodeBuild buildspec to install tools in this context? I already use CodeBuild to untar DynamoDB local and run it, but I don't have to worry about the "key considerations" list, and I feel like not having done this before it will be a lot of time consuming trial and error to get it right