Red Hat Training
A Red Hat training course is available for OpenShift Container Platform
8.3.3. 镜像源
可以通过镜像为构建过程提供额外的文件。输入镜像的引用方式与定义 From 和 To 镜像目标的方式相同。这意味着可以引用容器镜像和 镜像流标签。在使用镜像时,必须提供一个或多个路径对,以指示要复制镜像的文件或目录的路径以及构建上下文中要放置它们的目的地。
源路径可以是指定镜像内的任何绝对路径。目的地必须是相对目录路径。构建时会加载镜像,并将指定的文件和目录复制到构建过程上下文目录中。这与源存储库内容(若有)要克隆到的目录相同。如果源路径以 /. 结尾,则复制目录的内容,但不在目的地上创建该目录本身。
镜像输入在 BuildConfig 的 source 定义中指定:
source:
git:
uri: https://github.com/openshift/ruby-hello-world.git
images: 1
- from: 2
kind: ImageStreamTag
name: myinputimage:latest
namespace: mynamespace
paths: 3
- destinationDir: injected/dir 4
sourcePath: /usr/lib/somefile.jar 5
- from:
kind: ImageStreamTag
name: myotherinputimage:latest
namespace: myothernamespace
pullSecret: mysecret 6
paths:
- destinationDir: injected/dir
sourcePath: /usr/lib/somefile.jar注意
使用 Custom 策略的构建不支持此功能。