mycdc/Jenkinsfile

41 lines
1.1 KiB
Plaintext
Raw Normal View History

#!/usr/bin/env groovy
pipeline {
agent any
options {
disableConcurrentBuilds()
}
stages {
stage('Build') {
when {branch 'master'}
steps {
script {
def packageJson = readJSON file: 'package.json'
env.VERSION = packageJson.version
}
sh 'docker-compose build --build-arg BUILD_ID=$BUILD_ID --parallel'
}
}
stage('Push') {
when {branch 'master'}
environment {
CREDENTIALS = credentials('docker-registry')
}
steps {
script {
def packageJson = readJSON file: 'package.json'
env.VERSION = packageJson.version
}
2024-04-04 13:04:12 +00:00
sh 'docker login --username $CREDENTIALS_USR --password $CREDENTIALS_PSW $REGISTRY'
sh 'docker-compose push'
}
}
}
post {
unsuccessful {
setEnv()
sendEmail()
}
}
}