59 lines
944 B
Plaintext
59 lines
944 B
Plaintext
|
pipeline {
|
||
|
agent {
|
||
|
label 'local-agent'
|
||
|
}
|
||
|
|
||
|
options {
|
||
|
ansiColor('xterm')
|
||
|
timestamps()
|
||
|
}
|
||
|
|
||
|
environment {
|
||
|
DOCKER_IMAGE = 'public/reddit-slideshow'
|
||
|
DOCKER_REGISTRY = credentials('docker_registry')
|
||
|
}
|
||
|
|
||
|
stages {
|
||
|
stage('Build Docker Image') {
|
||
|
when {
|
||
|
allOf {
|
||
|
branch 'master'
|
||
|
|
||
|
not {
|
||
|
changeRequest()
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
steps {
|
||
|
echo 'Building docker image...'
|
||
|
|
||
|
script {
|
||
|
image = docker.build(DOCKER_IMAGE)
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
stage('Deploy Docker Image') {
|
||
|
when {
|
||
|
allOf {
|
||
|
branch 'master'
|
||
|
|
||
|
not {
|
||
|
changeRequest()
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
steps {
|
||
|
echo 'Deploying docker image to registry...'
|
||
|
|
||
|
script {
|
||
|
docker.withRegistry(DOCKER_REGISTRY, 'gitea_packages_account') {
|
||
|
image.push('latest')
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|