Skip to content

Instantly share code, notes, and snippets.

@dmc5179
Created August 4, 2021 10:03
Show Gist options
  • Save dmc5179/9828b7971f94116f4296a74b5698ae10 to your computer and use it in GitHub Desktop.
Save dmc5179/9828b7971f94116f4296a74b5698ae10 to your computer and use it in GitHub Desktop.
OpenShift 4 Build Config using the Docker Strategy
---
kind: ImageStream
apiVersion: image.openshift.io/v1
metadata:
name: myapp
namespace: mynamespace
spec: {}
---
kind: BuildConfig
apiVersion: build.openshift.io/v1
metadata:
name: myapp
namespace: namespace
spec:
output:
to:
kind: "ImageStreamTag"
name: "myapp:latest"
failedBuildsHistoryLimit: 5
successfulBuildsHistoryLimit: 5
nodeSelector: null
postCommit: {}
resources: {}
runPolicy: SerialLatestOnly
source:
git:
ref: danclark
uri: https://bitbucket.di2e.net/scm/dime/icpf-service.git
sourceSecret:
name: danclark-git
type: Git
strategy:
type: Docker
dockerStrategy:
dockerfilePath: Dockerfile
env:
- name: NPM_TOKEN
value: XXXX
- name: NPM_ENV
value: "production"
triggers:
- imageChange:
type: ImageChange
- type: ConfigChange
---
kind: Service
apiVersion: v1
metadata:
name: myapp
namespace: mynamespace
spec:
ports:
- protocol: TCP
port: 4000
targetPort: 4000
selector:
app: myapp
---
kind: DeploymentConfig
apiVersion: apps.openshift.io/v1
metadata:
name: myapp
namespace: mynamespace
spec:
strategy:
type: Rolling
triggers:
- type: ConfigChange
- type: ImageChange
imageChangeParams:
automatic: true
containerNames:
- myapp
from:
kind: ImageStreamTag
namespace: mynamespace
name: 'myapp:latest'
replicas: 1
selector:
app: myapp
template:
metadata:
labels:
app: myapp
spec:
containers:
- name: myapp
image: myapp:latest
command:
- 'npm'
# - sh
args:
- 'run'
- 'start:prod'
# - '-c'
# - 'sleep infinity'
# - './src/start.sh'
ports:
- containerPort: 4000
protocol: TCP
env:
- name: "CI"
value: "true"
- name: IS_CONTAINER
value: "true"
imagePullPolicy: Always
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment