This documentation is for a release that is no longer maintained
See documentation for the latest supported version 3 or the latest supported version 4.5.2.5.2. 如何编写 Source-to-image 脚本
						您可以使用任何编程语言编写 S2I 脚本,只要脚本可在构建器镜像中执行。S2I 支持多种提供 assemble/run/save-artifacts 脚本的选项。每次构建时按以下顺序检查所有这些位置:
					
- 构建配置中指定的脚本。
 - 
								在应用程序源 
.s2i/bin目录中找到的脚本。 - 
								在默认镜像 URL 中找到的带有 
io.openshift.s2i.scripts-url标签的脚本。 
						镜像中指定的 io.openshift.s2i.scripts-url 标签和构建配置中指定的脚本都可以采用以下形式之一:
					
- 
								
image:///path_to_scripts_dir:镜像中 S2I 脚本所处目录的绝对路径 - 
								
file:///path_to_scripts_dir:主机上 S2I 脚本所处目录的相对或绝对路径 - 
								
http(s)://path_to_scripts_dir:S2I 脚本所处目录的 URL 
| 脚本 | 描述 | 
|---|---|
|   
										  |   
										 
  | 
|   
										  |   
										  | 
|   
										  |   
										 
 
										这些依赖项会收集到一个   | 
|   
										  |   
										借助   | 
|   
										  |   
										借助  
 注意 
											建议将   | 
S2I 脚本示例
						以下示例 S2I 脚本采用 Bash 编写。每个示例都假定其 tar 内容解包到 /tmp/s2i 目录中。
					
assemble 脚本:
run 脚本:
run the application
#!/bin/bash
# run the application
/opt/application/run.sh
save-artifacts 脚本:
usage 脚本: