From 88b623f375e693295d4ac1fdb219e5eafbae5eff Mon Sep 17 00:00:00 2001 From: Kirill <87102039+KeraLLenarium@users.noreply.github.com> Date: Tue, 11 Jun 2024 14:48:49 +0300 Subject: [PATCH] Create Jenkinsfile --- Jenkinsfile | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 Jenkinsfile diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 000000000..344bf3b4a --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,36 @@ +pipeline { + agent none + stages { + stage('Build') { + agent { + label 'builder' + } + steps { + sh ''' + git clone https://github.com/KeraLLenarium/spring-petclinic.git + cd spring-petclinic + ./mvnw spring-boot:build-image + docker tag spring-petclinic:3.3.0-SNAPSHOT kerallenarium/spring-petclinic + docker push kerallenarium/spring-petclinic + docker rmi -f $(docker images -q) + ''' + } + post { + always { + sh 'rm -rf spring-petclinic' + } + } + } + stage('Deploy') { + agent { + label 'production' + } + steps { + sh ''' + docker pull kerallenarium/spring-petclinic:latest + docker run -d -p 80:8080 kerallenarium/spring-petclinic:latest + ''' + } + } + } +}