Swa*_*tra 4 buildconfig openshift
我想创建一个构建器图像app_name:latest,它将接受多个源输入,例如,另一个图像和一个二进制源,然后将输出创建到app_name:latest.
例子 -
{
"kind": "BuildConfig",
"apiVersion": "v1",
"metadata": {
"name": "app_name",
"labels": {
"application": "app_name"
}
},
"spec": {
"source": {
"type": "Git",
"git": {
"uri": "https://github.com/xyz/app_name.git",
"ref": "master"
},
"contextDir": ""
},
"strategy": {
"type": "Source",
"sourceStrategy": {
"from": {
"kind": "ImageStreamTag",
"namespace": "openshift",
"name": "java-s2i:latest"
}
}
},
"output": {
"to": {
"kind": "ImageStreamTag",
"name": "app_name:latest"
}
},
"triggers": [{
"type": "GitHub",
"generic": {
"secret": "secret"
}
},
{
"type": "Generic",
"github": {
"secret": "secret"
}
},
{
"type": "ImageChange",
"imageChange": {}
}
]
}
}
Run Code Online (Sandbox Code Playgroud)
您可以使用所谓的链式构建。
当使用oc new-build创建图像,使用以下选项:
--source-image='': Specify an image to use as source for the build. You must also specify --source-image-path.
--source-image-path='': Specify the file or directory to copy from the source image and its destination in the build directory. Format:
Run Code Online (Sandbox Code Playgroud)
to 的参数--source-image是从单独构建创建的现有图像流的名称。这可能包含其他预编译的工件或数据文件。
参数 to--source-image-path是复制文件的图像中的绝对路径,以及源构建注入的上传文件目录中的相对路径名,应放置来自单独图像的文件。后者不能是绝对路径,因此您可能必须覆盖assemble脚本才能将其移动到正确的位置。
就原始构建配置中的情况而言,它是:
"source": {
"git": {
"ref": "master",
"uri": "https://github.com/jakevdp/PythonDataScienceHandbook"
},
"images": [
{
"from": {
"kind": "ImageStreamTag",
"name": "packages-python-27:latest"
},
"paths": [
{
"destinationDir": ".s2i",
"sourcePath": "/opt/app-root/packages"
}
]
},
{
"from": {
"kind": "ImageStreamTag",
"name": "packages-python-35-wheelhouse:latest"
},
"paths": [
{
"destinationDir": ".s2i",
"sourcePath": "/opt/app-root/packages"
}
]
},
...
},
},
Run Code Online (Sandbox Code Playgroud)
直接添加到原始构建配置时,您可以拥有多个图像源。命令行只允许设置一个。
| 归档时间: |
|
| 查看次数: |
1067 次 |
| 最近记录: |