简体   繁体   English

使用 CNB Paketo Image-Labels-Buildpack 和生命周期创建器配置容器镜像标签

[英]Configure container image labels using CNB Paketo Image-Labels-Buildpack and the lifecycle creator

We're using a CNB builder image inside a GitLab CI/CD pipeline in order to automatically build our application and bake it into an image.我们在 GitLab CI/CD 管道中使用 CNB 构建器映像,以自动构建我们的应用程序并将其烘焙到映像中。

Because we can't use docker in docker on our container orchestrator, we can not use the pack CLI und must resort to calling the cnb/lifecycle/creator directly.因为我们不能在容器编排器上使用 docker 中的 docker,所以我们不能使用 pack CLI,必须求助于直接调用 cnb/lifecycle/creator。

We'd like to add additional labels to the produced image using the Paketo image-labels buildpack.我们想使用 Paketo image-labels buildpack 为生成的图像添加额外的标签。 The docs state that setting the variables prefixed with BP_OCI_XXX should suffice in order for the corresponding label to be set.设置前缀为 BP_OCI_XXX 的变量的文档 state 应该足以设置相应的 label。 When using the pack CLI, one can specify this using the --env flag.使用 pack CLI 时,可以使用 --env 标志指定它。 Simply setting the value as an environment variable doesn't seem to work.简单地将值设置为环境变量似乎不起作用。

How can I pass those configurations to the creator?如何将这些配置传递给创建者?

I found the answer in the platform specification: https://github.com/buildpacks/spec/blob/main/platform.md#user-provided-variables我在平台规范中找到了答案: https://github.com/buildpacks/spec/blob/main/platform.md#user-provided-variables

This means all env vars simply need to be created as key-value pairs (varname is the filename and value is the content of the file) inside the <platform>/env/ directory.这意味着所有环境变量只需要在<platform>/env/目录中创建为键值对(varname 是文件名,value 是文件的内容)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM