Added Jenkinsfile (#1)

This commit is contained in:
Marcus Noble
2019-12-24 11:37:29 +00:00
parent 12e1d6d437
commit fc1066c455
6 changed files with 44 additions and 18 deletions

32
Jenkinsfile vendored Normal file
View File

@@ -0,0 +1,32 @@
pipeline {
agent { label "dind" }
stages {
stage('Create Docker image') {
steps {
container('docker') {
sh """
docker build -t docker.cloud.cluster.fun/averagemarcus/blog:${env.GIT_COMMIT} .
"""
}
}
}
stage('Publish Docker image') {
when { branch 'master' }
environment {
DOCKER_CREDS = credentials('Harbor')
}
steps {
container('docker') {
sh """
docker login docker.cloud.cluster.fun -u $DOCKER_CREDS_USR -p $DOCKER_CREDS_PSW
docker push docker.cloud.cluster.fun/averagemarcus/blog:${env.GIT_COMMIT}
"""
}
}
}
}
}