This commit is contained in:
parent
8f248f4425
commit
3ae239f3e1
|
@ -0,0 +1,49 @@
|
||||||
|
#!/usr/bin/env groovy
|
||||||
|
|
||||||
|
pipeline {
|
||||||
|
agent any
|
||||||
|
environment {
|
||||||
|
PROJECT_NAME = 'printnatura'
|
||||||
|
STACK_NAME = "${env.PROJECT_NAME}-${env.BRANCH_NAME}"
|
||||||
|
}
|
||||||
|
stages {
|
||||||
|
stage('Checkout') {
|
||||||
|
steps {
|
||||||
|
setEnv()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
stage('Container') {
|
||||||
|
when {
|
||||||
|
anyOf {
|
||||||
|
branch 'test'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
environment {
|
||||||
|
CREDS = credentials('docker-registry')
|
||||||
|
}
|
||||||
|
steps {
|
||||||
|
sh 'docker login --username $CREDS_USR --password $CREDS_PSW $REGISTRY'
|
||||||
|
sh 'docker-compose build --build-arg BUILD_ID=$BUILD_ID --parallel'
|
||||||
|
sh 'docker-compose push'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
stage('Deploy') {
|
||||||
|
when {
|
||||||
|
anyOf {
|
||||||
|
branch 'test'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
environment {
|
||||||
|
DOCKER_HOST = "${env.SWARM_HOST}"
|
||||||
|
}
|
||||||
|
steps {
|
||||||
|
sh "docker stack deploy --with-registry-auth --compose-file docker-compose.yml ${env.STACK_NAME}"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
post {
|
||||||
|
unsuccessful {
|
||||||
|
sendEmail()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,32 @@
|
||||||
|
version: '3.7'
|
||||||
|
services:
|
||||||
|
main:
|
||||||
|
image: registry.verdnatura.es/printnatura:latest
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
ports:
|
||||||
|
- 631
|
||||||
|
configs:
|
||||||
|
- source: config
|
||||||
|
target: /printnatura/config.local.yml
|
||||||
|
- source: cups
|
||||||
|
target: /etc/cups/cupsd.conf
|
||||||
|
volumes:
|
||||||
|
- ppd:/etc/cups/ppd
|
||||||
|
deploy:
|
||||||
|
placement:
|
||||||
|
constraints:
|
||||||
|
- node.role == worker
|
||||||
|
volumes:
|
||||||
|
ppd:
|
||||||
|
driver: rexray
|
||||||
|
driver_opts:
|
||||||
|
size: 1
|
||||||
|
configs:
|
||||||
|
config:
|
||||||
|
external: true
|
||||||
|
name: printnatura_config
|
||||||
|
cups:
|
||||||
|
external: true
|
||||||
|
name: printnatura_cups
|
Loading…
Reference in New Issue