Last active
August 4, 2020 21:54
-
-
Save pablorcruh/9ab84ad1af077adbc805dad38f5486c4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pipeline { | |
agent { label 'master' } | |
options { | |
buildDiscarder(logRotator(numToKeepStr: '1', artifactNumToKeepStr: '1', daysToKeepStr: '5')) | |
} | |
stages { | |
stage ('build') { | |
agent { | |
docker { | |
image 'nginx:alpine' | |
} | |
} | |
when { branch 'master' } | |
steps { | |
stash includes: '**', name: 'web' | |
} | |
} | |
stage ('build docker') { | |
when {branch 'master'} | |
steps { | |
unstash 'web' | |
sh ''' | |
docker login -u usuario -p password | |
docker build -t pablorcruh/proyecto-pagina-web:latest . | |
docker tag pablorcruh/proyecto-pagina-web:latest pablorcruh/proyecto-pagina-web:latest | |
docker push pablorcruh/proyecto-pagina-web:latest | |
''' | |
} | |
} | |
stage ('deploy') { | |
when {branch 'master'} | |
steps { | |
build job: '../deploy-devops/master', | |
parameters: [ | |
[$class: 'StringParameterValue', name: 'DEPLOY_ENV', value: 'prod'], | |
[$class: 'StringParameterValue', name: 'SERVICES_TO_DEPLOY', value: "proyecto-pagina-web:latest"], | |
[$class: 'StringParameterValue', name: 'DOCKER_COMPOSE_ARGUMENTS', value: "--no-deps"] | |
] | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment