在 AWS Lambda 中运行 CI/CD 管道

发布于 2025-01-10 22:58:42 字数 451 浏览 0 评论 0原文

作为一个项目,我尝试创建一个在 AWS Lambda 应用程序内运行的 CI/CD 管道。

我面临的问题是 AWS Lambda 缺少某些应用程序(例如 Gradle)正常运行所需的一些工具(例如 xargs):

/tmp/repo/gradlew:第 234 行:xargs:找不到命令

或者更有趣的是:

安装:apt-get:找不到命令

如何安装所需的工具来从 AWS Lambda 容器内构建应用程序?

如何利用层来加速这些容器? 另外,我假设我需要注册某些 cli 工具存在于安装层中。 在 Windows 上,我会通过 (ab) 使用 PATH 环境变量来执行此操作,但在 Linux 中执行此操作的推荐方法是什么?

我如何告诉工具在这些层中寻找它们的依赖关系?以避免出现如下错误: ld.gold:错误:找不到-lcurl

As a project, I am trying to create a CI/CD pipeline running inside an AWS Lambda application.

The problem I am facing is that AWS Lambda is missing some tools (for example xargs) that certain applications (for example Gradle) require to run properly:

/tmp/repo/gradlew: line 234: xargs: command not found

Or even more interestingly:

install: apt-get: command not found

How can I install the required tools to build the applications from within an AWS Lambda container?

How can I utilize layers to speed up those containers?
Aka, I assume I need to register that certain cli tools are present in mounted layers.
On windows, I would do this by (ab)using the PATH environment variable, but what is the recommended way to do this in Linux?

And how can I tell tools to look for their dependencies in those layers? to avoid errors like:
ld.gold: error: cannot find -lcurl

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

呢古 2025-01-17 22:58:42

据我所知,最好的选择是创建一个包含您需要的所有软件的 Docker 映像,并将其提供给 AWS Lambda 服务。

有大量文档介绍了如何在 AWS Lambda 中运行 Docker 容器:

https ://docs.aws.amazon.com/lambda/latest/dg/images-create.html


个人说明:虽然我喜欢挑战或概念验证的想法我建议使用众多 CI/CD 服务之一,而不是您自己构建一项。我想不出这有什么好处。 AWS 本身提供 CI/CD 解决方案,例如 AWS CodePipeline 等。

您可能需要查看以下文档:

https://aws.amazon.com/getting-started/hands-on/set-up-ci-cd-pipeline/

The best option as far as I can tell is to create a Docker image containing all the software that you require and provide this to the AWS Lambda service.

There is extensive documentation how to run Docker containers in AWS Lambda:

https://docs.aws.amazon.com/lambda/latest/dg/images-create.html


Personal note: While I like the idea of a challenge or proof-of-concept I'd recommend using one of the many CI/CD services out there instead of building one on your own. I can not think of any upside of this. AWS itself offers CI/CD solutions like AWS CodePipeline etc.

You might want to have a look at the following documentation:

https://aws.amazon.com/getting-started/hands-on/set-up-ci-cd-pipeline/

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文