Last active
February 14, 2019 13:55
-
-
Save jorgemoralespou/ad61e7b8049ccd5720ff8346c06c8eb3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: v1 | |
kind: Template | |
metadata: | |
name: galleon-chained-build | |
annotations: | |
iconClass: icon-wildfly | |
openshift.io/display-name: Galleon S2I chained build | |
openshift.io/provider-display-name: Red Hat, Inc. | |
template.openshift.io/long-description: Chained build to provision Wildfly server image using galleon and build/deploy app. | |
description: Chained build to provision Wildfly server image using galleon and build/deploy app. | |
message: Builds created. | |
labels: | |
template: galleon-chained-build | |
parameters: | |
- name: APP_NAME | |
description: The application name. Name is assigned to all of the application objects defined in this template. | |
displayName: Image Name | |
required: true | |
value: my-app | |
- name: GIT_REPO | |
description: The application git repository | |
displayName: git repository | |
required: true | |
value: https://github.com/openshift/openshift-jee-sample | |
- name: GIT_CONTEXT_DIR | |
description: The application git repository sub directory | |
displayName: git repository sub directory | |
required: false | |
value: | |
- name: GIT_BRANCH | |
description: The application git branch | |
displayName: git branch | |
required: true | |
value: master | |
- name: FP_PRODUCER | |
description: The Feature-Pack producer | |
displayName: The Feature-Pack producer | |
required: true | |
value: wildfly-servlet | |
- name: FP_CHANNEL | |
description: The Feature-Pack channel | |
displayName: The Feature-Pack channel | |
required: true | |
value: current | |
- name: FP_LAYERS | |
description: Comma separated list of features to install (web-server, cloud-profile, core-tools) | |
displayName: The Wildfly server features to provision (Needed by your application) | |
required: false | |
value: web-server | |
objects: | |
- apiVersion: image.openshift.io/v1 | |
kind: ImageStream | |
metadata: | |
labels: | |
app: ${APP_NAME} | |
name: ${APP_NAME}-server | |
- apiVersion: image.openshift.io/v1 | |
kind: ImageStream | |
metadata: | |
labels: | |
app: ${APP_NAME} | |
name: ${APP_NAME}-app | |
- apiVersion: image.openshift.io/v1 | |
kind: ImageStream | |
metadata: | |
labels: | |
app: ${APP_NAME} | |
name: ${APP_NAME} | |
- apiVersion: build.openshift.io/v1 | |
kind: BuildConfig | |
metadata: | |
labels: | |
app: ${APP_NAME} | |
name: ${APP_NAME}-server | |
spec: | |
output: | |
to: | |
kind: ImageStreamTag | |
name: ${APP_NAME}-server:latest | |
runPolicy: Serial | |
source: | |
dockerfile: |- | |
FROM java:8 | |
RUN wget https://github.com/jfdenise/galleon-openshift/releases/download/1.0/galleon-3.0.1.Final-SNAPSHOT.zip && \ | |
unzip galleon-3.0.1.Final-SNAPSHOT.zip | |
RUN galleon-3.0.1.Final-SNAPSHOT/bin/galleon.sh install ${FP_PRODUCER}:${FP_CHANNEL} --dir=/wildfly --default-configs=standalone/standalone.xml --verbose | |
type: Docker | |
strategy: | |
dockerStrategy: | |
type: Docker | |
triggers: | |
- type: ConfigChange | |
- apiVersion: build.openshift.io/v1 | |
kind: BuildConfig | |
metadata: | |
labels: | |
app: ${APP_NAME} | |
name: ${APP_NAME}-app | |
spec: | |
output: | |
to: | |
kind: ImageStreamTag | |
name: ${APP_NAME}-app:latest | |
runPolicy: Serial | |
source: | |
git: | |
ref: ${GIT_BRANCH} | |
uri: ${GIT_REPO} | |
contextDir: ${GIT_CONTEXT_DIR} | |
type: Git | |
strategy: | |
sourceStrategy: | |
from: | |
kind: ImageStreamTag | |
name: java:8 | |
namespace: openshift | |
type: Source | |
triggers: | |
- imageChange: | |
type: ImageChange | |
- type: ConfigChange | |
- generic: | |
secret: secret101 | |
type: Generic | |
- github: | |
secret: secret101 | |
type: GitHub | |
- apiVersion: build.openshift.io/v1 | |
kind: BuildConfig | |
metadata: | |
labels: | |
app: ${APP_NAME} | |
name: ${APP_NAME} | |
spec: | |
output: | |
to: | |
kind: ImageStreamTag | |
name: ${APP_NAME}:latest | |
source: | |
dockerfile: |- | |
FROM openjdk:8-jre | |
RUN groupadd -r wildfly -g 1000 && useradd -u 1000 -r -g wildfly -d /opt/wildfly -s /sbin/nologin -c "Wildfly user" wildfly | |
COPY wildfly /opt/wildfly | |
RUN rm -rf /opt/wildfly/standalone/configuration/standalone_xml_history/current | |
RUN chmod -R 777 /opt/wildfly/standalone | |
RUN chown -R wildfly /opt/wildfly | |
COPY ROOT.war /opt/wildfly/standalone/deployments | |
USER wildfly | |
EXPOSE 8080 | |
CMD ["/opt/wildfly/bin/standalone.sh", "-b", "0.0.0.0"] | |
images: | |
- from: | |
kind: ImageStreamTag | |
name: ${APP_NAME}-server:latest | |
paths: | |
- sourcePath: /wildfly | |
destinationDir: "." | |
- from: | |
kind: ImageStreamTag | |
name: ${APP_NAME}-app:latest | |
paths: | |
- sourcePath: /tmp/src/target/ROOT.war | |
destinationDir: "." | |
strategy: | |
dockerStrategy: | |
type: Docker | |
triggers: | |
- type: ImageChange | |
imageChange: | |
from: | |
kind: ImageStreamTag | |
name: ${APP_NAME}-server:latest | |
- type: ImageChange | |
imageChange: | |
from: | |
kind: ImageStreamTag | |
name: ${APP_NAME}-app:latest | |
- type: ConfigChange | |
- apiVersion: apps.openshift.io/v1 | |
kind: DeploymentConfig | |
metadata: | |
labels: | |
app: ${APP_NAME} | |
name: ${APP_NAME} | |
spec: | |
replicas: 1 | |
selector: | |
app: ${APP_NAME} | |
deploymentconfig: ${APP_NAME} | |
strategy: | |
rollingParams: | |
intervalSeconds: 1 | |
maxSurge: 25% | |
maxUnavailable: 25% | |
timeoutSeconds: 600 | |
updatePeriodSeconds: 1 | |
type: Rolling | |
template: | |
metadata: | |
labels: | |
app: ${APP_NAME} | |
deploymentconfig: ${APP_NAME} | |
spec: | |
containers: | |
- image: ${APP_NAME}:latest | |
imagePullPolicy: Always | |
name: ${APP_NAME} | |
ports: | |
- containerPort: 8080 | |
protocol: TCP | |
resources: {} | |
terminationMessagePath: /dev/termination-log | |
livenessProbe: | |
httpGet: | |
path: / | |
port: 8080 | |
scheme: HTTP | |
initialDelaySeconds: 10 | |
timeoutSeconds: 2 | |
periodSeconds: 10 | |
successThreshold: 1 | |
failureThreshold: 3 | |
readinessProbe: | |
httpGet: | |
path: / | |
port: 8080 | |
scheme: HTTP | |
initialDelaySeconds: 30 | |
timeoutSeconds: 2 | |
periodSeconds: 10 | |
successThreshold: 1 | |
failureThreshold: 3 | |
dnsPolicy: ClusterFirst | |
restartPolicy: Always | |
securityContext: {} | |
terminationGracePeriodSeconds: 30 | |
test: false | |
triggers: | |
- type: ConfigChange | |
- imageChangeParams: | |
automatic: true | |
containerNames: | |
- ${APP_NAME} | |
from: | |
kind: ImageStreamTag | |
name: ${APP_NAME}:latest | |
type: ImageChange | |
status: {} | |
- apiVersion: v1 | |
kind: Service | |
metadata: | |
labels: | |
app: ${APP_NAME} | |
name: ${APP_NAME} | |
spec: | |
ports: | |
- name: 8080-tcp | |
port: 8080 | |
protocol: TCP | |
targetPort: 8080 | |
selector: | |
app: ${APP_NAME} | |
deploymentconfig: ${APP_NAME} | |
sessionAffinity: None | |
type: ClusterIP | |
- apiVersion: route.openshift.io/v1 | |
kind: Route | |
metadata: | |
name: ${APP_NAME} | |
labels: | |
app: ${APP_NAME} | |
spec: | |
to: | |
kind: Service | |
name: ${APP_NAME} | |
weight: 100 | |
port: | |
targetPort: 8080-tcp | |
wildcardPolicy: None |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment