Skip to content

Instantly share code, notes, and snippets.

@lholmquist
Created August 3, 2018 20:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lholmquist/91729dd36ea73747b22d074769d81af1 to your computer and use it in GitHub Desktop.
Save lholmquist/91729dd36ea73747b22d074769d81af1 to your computer and use it in GitHub Desktop.
apiVersion: v1
kind: Template
metadata:
name: angular-web-app
annotations:
iconClass: icon-jboss
tags: nodejs, angular, web app
template.openshift.io/provider-display-name: "Red Hat, Inc."
description: Just building a little angular app with a web builder
parameters:
- name: SOURCE_REPOSITORY_URL
description: The source URL for the application
displayName: Source URL
required: true
- name: SOURCE_REPOSITORY_REF
description: The branch name for the application
displayName: Source Branch
value: master
required: true
- name: SOURCE_REPOSITORY_DIR
description: The location within the source repo of the application
displayName: Source Directory
value: .
required: true
- name: OUTPUT_DIR
description: The location of the compiled static files from your web apps builder
displayName: Output Directory
value: build
required: false
- name: GITHUB_WEBHOOK_SECRET
description: A secret string used to configure the GitHub webhook.
displayName: GitHub Webhook Secret
required: true
from: '[a-zA-Z0-9]{40}'
generate: expression
objects:
- apiVersion: v1
kind: ImageStream
metadata:
name: angular-web-app-builder
spec: {}
- apiVersion: v1
kind: ImageStream
metadata:
name: angular-web-app-runtime
spec: {}
- apiVersion: v1
kind: ImageStream
metadata:
name: web-app-builder-runtime
spec:
tags:
- name: latest
from:
kind: DockerImage
name: bucharestgold/centos7-s2i-web-app:0.0.1
- apiVersion: v1
kind: ImageStream
metadata:
name: nginx-image-runtime
spec:
tags:
- name: latest
from:
kind: DockerImage
name: 'centos/nginx-112-centos7:latest'
- apiVersion: v1
kind: BuildConfig
metadata:
name: angular-web-app-builder
spec:
output:
to:
kind: ImageStreamTag
name: angular-web-app-builder:latest
postCommit: {}
resources: {}
source:
git:
uri: ${SOURCE_REPOSITORY_URL}
ref: ${SOURCE_REPOSITORY_REF}
contextDir: ${SOURCE_REPOSITORY_DIR}
type: Git
strategy:
sourceStrategy:
env:
- name: OUTPUT_DIR
value: ${OUTPUT_DIR}
from:
kind: ImageStreamTag
name: web-app-builder-runtime:latest
incremental: true
type: Source
triggers:
- github:
secret: ${GITHUB_WEBHOOK_SECRET}
type: GitHub
- type: ConfigChange
- imageChange: {}
type: ImageChange
status:
lastVersion: 0
- apiVersion: v1
kind: BuildConfig
metadata:
name: angular-web-app-runtime
spec:
output:
to:
kind: ImageStreamTag
name: angular-web-app-runtime:latest
postCommit: {}
resources: {}
source:
type: Image
images:
- from:
kind: ImageStreamTag
name: angular-web-app-builder:latest
paths:
- destinationDir: .
sourcePath: /opt/app-root/src/${OUTPUT_DIR}/.
strategy:
sourceStrategy:
from:
kind: ImageStreamTag
name: nginx-image-runtime:latest
incremental: true
type: Source
triggers:
- github:
secret: ${GITHUB_WEBHOOK_SECRET}
type: GitHub
- type: ConfigChange
- type: ImageChange
imageChange: {}
- type: ImageChange
imageChange:
from:
kind: ImageStreamTag
name: angular-web-app-builder:latest
status:
lastVersion: 0
- apiVersion: v1
kind: DeploymentConfig
metadata:
labels:
app: angular-web-app
name: angular-web-app
spec:
replicas: 1
revisionHistoryLimit: 2
selector:
app: angular-web-app
strategy:
rollingParams:
timeoutSeconds: 3600
type: Rolling
template:
metadata:
labels:
app: angular-web-app
spec:
containers:
- env:
- name: KUBERNETES_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
image: angular-web-app-runtime
imagePullPolicy: IfNotPresent
name: angular-web-app-runtime
ports:
- containerPort: 8080
name: http
protocol: TCP
metadata:
labels:
app: angular-web-app
triggers:
- type: ConfigChange
- type: ImageChange
imageChangeParams:
automatic: true
containerNames:
- angular-web-app-runtime
from:
kind: ImageStreamTag
name: 'angular-web-app-runtime:latest'
- apiVersion: v1
kind: Service
metadata:
labels:
app: angular-web-app
name: angular-web-app
spec:
ports:
- name: http
port: 8080
selector:
app: angular-web-app
- apiVersion: v1
kind: Route
metadata:
labels:
app: angular-web-app
name: frontend
spec:
port:
targetPort: 8080
to:
kind: Service
name: angular-web-app
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment