{
	"kind": "Template",
	"apiVersion": "v1",
	"metadata": {
		"name": "wildfly-s2i-chained-build-template",
		"creationTimestamp": null,
		"annotations": {
			"description": "S2I build of WildFly application (\u003capp-name\u003e-build-artifacts image) followed by a build to create a lightweight application image (\u003capp-name\u003e image). \u003capp-name\u003e image can then be managed by the WildFly Operator.",
			"iconClass": "icon-wildfly",
			"openshift.io/display-name": "WildFly S2I Chained Build",
			"openshift.io/provider-display-name": "Red Hat, Inc.",
			"template.openshift.io/long-description": "S2I build of WildFly application (\u003capp-name\u003e-build-artifacts image) followed by a build to create a lightweight application image (\u003capp-name\u003e image). \u003capp-name\u003e image can then be managed by the WildFly Operator."
		}
	},
	"objects": [
		{
			"apiVersion": "image.openshift.io/v1",
			"kind": "ImageStream",
			"metadata": {
				"labels": {
					"app": "${APPLICATION_NAME}"
				},
				"name": "${APPLICATION_NAME}"
			}
		},
		{
			"apiVersion": "image.openshift.io/v1",
			"kind": "ImageStream",
			"metadata": {
				"labels": {
					"app": "${APPLICATION_NAME}-build-artifacts"
				},
				"name": "${APPLICATION_NAME}-build-artifacts"
			}
		},
		{
			"apiVersion": "build.openshift.io/v1",
			"kind": "BuildConfig",
			"metadata": {
				"labels": {
					"app": "${APPLICATION_NAME}-build-artifacts"
				},
				"name": "${APPLICATION_NAME}-build-artifacts"
			},
			"spec": {
				"output": {
					"to": {
						"kind": "ImageStreamTag",
						"name": "${APPLICATION_NAME}-build-artifacts:latest"
					}
				},
				"runPolicy": "Serial",
				"source": {
					"contextDir": "${GIT_CONTEXT_DIR}",
					"git": {
						"ref": "${GIT_BRANCH}",
						"uri": "${GIT_REPO}"
					},
					"type": "Git"
				},
				"strategy": {
					"sourceStrategy": {
						"env": [
							{
								"name": "GALLEON_PROVISION_LAYERS",
								"value": "${GALLEON_PROVISION_LAYERS}"
							},
							{
								"name": "GALLEON_PROVISION_DEFAULT_FAT_SERVER",
								"value": "true"
							}
						],
						"from": {
							"kind": "ImageStreamTag",
							"name": "wildfly:latest",
							"namespace": "${IMAGE_STREAM_NAMESPACE}"
						}
					},
					"type": "Source"
				},
				"triggers": [
					{
						"imageChange": null,
						"type": "ImageChange"
					},
					{
						"type": "ConfigChange"
					}
				]
			}
		},
		{
			"apiVersion": "build.openshift.io/v1",
			"kind": "BuildConfig",
			"metadata": {
				"labels": {
					"app": "${APPLICATION_NAME}"
				},
				"name": "${APPLICATION_NAME}"
			},
			"spec": {
				"output": {
					"to": {
						"kind": "ImageStreamTag",
						"name": "${APPLICATION_NAME}:latest"
					}
				},
				"source": {
					"dockerfile": "FROM wildfly-runtime-centos7:latest\nCOPY /server $JBOSS_HOME\nUSER root\nRUN chown -R jboss:root $JBOSS_HOME \u0026\u0026 chmod -R ug+rwX $JBOSS_HOME\nRUN ln -s $JBOSS_HOME /wildfly \nUSER jboss\nCMD $JBOSS_HOME/bin/openshift-launch.sh",
					"images": [
						{
							"from": {
								"kind": "ImageStreamTag",
								"name": "${APPLICATION_NAME}-build-artifacts:latest"
							},
							"paths": [
								{
									"destinationDir": ".",
									"sourcePath": "/s2i-output/server/"
								}
							]
						}
					]
				},
				"strategy": {
					"dockerStrategy": {
						"from": {
							"kind": "ImageStreamTag",
							"name": "wildfly-runtime:latest",
							"namespace": "${IMAGE_STREAM_NAMESPACE}"
						},
						"imageOptimizationPolicy": "SkipLayers"
					},
					"type": "Docker"
				},
				"triggers": [
					{
						"imageChange": {
							"from": {
								"kind": "ImageStreamTag",
								"name": "${APPLICATION_NAME}-build-artifacts:latest"
							}
						},
						"type": "ImageChange"
					},
					{
						"type": "ConfigChange"
					}
				]
			}
		}
	],
	"parameters": [
		{
			"name": "APPLICATION_NAME",
			"displayName": "Image Name",
			"description": "The application name. Name is assigned to all of the application objects defined in this template.",
			"value": "wildfly-app",
			"required": true
		},
		{
			"name": "GIT_REPO",
			"displayName": "git repository",
			"description": "The application git repository",
			"value": "https://github.com/openshift/openshift-jee-sample.git",
			"required": true
		},
		{
			"name": "GIT_CONTEXT_DIR",
			"displayName": "git repository sub directory",
			"description": "The application git repository sub directory"
		},
		{
			"name": "GIT_BRANCH",
			"displayName": "git branch",
			"description": "The application git branch",
			"value": "master"
		},
		{
			"name": "IMAGE_STREAM_NAMESPACE",
			"displayName": "ImageStreams Namespace",
			"description": "Namespace in which the ImageStreams for WildFly images are installed. These ImageStreams are normally installed in the openshift namespace. You should only need to modify this if you've installed the ImageStreams in a different namespace/project.",
			"value": "openshift",
			"required": true
		},
		{
			"name": "GALLEON_PROVISION_LAYERS",
			"displayName": "List of Galleon layers.",
			"description": "A comma separated lists of galleon layers to provision. The main layers are cloud-server, jaxrs-server and datasources-web-server. You can check documentation to get more details on layers."
		}
	],
	"labels": {
		"template": "wildfly-s2i-chained-build-template"
	}
}