diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 00000000..879e1432 --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,31 @@ +pipeline { + agent { label 'linux' } + options { + buildDiscarder(logRotator(numToKeepStr: '5')) + } + environment { + DOCKERHUB_CREDENTIALS = credentials('dockerhub') + } + stages { + stage('Build') { + steps { + sh 'docker build -t buzzerburger/test:latest ./app' + } + } + stage('Login') { + steps { + sh 'echo $DOCKERHUB_CREDENTIALS_PSW | docker login -u $DOCKERHUB_CREDENTIALS_USR --password-stdin' + } + } + stage('Push') { + steps { + sh 'docker push buzzerburger/test:latest' + } + } + } + post { + always { + sh 'docker logout' + } + } +} \ No newline at end of file