From ffcd223728cc30c6d211df1ffc19d8dea15cb9a9 Mon Sep 17 00:00:00 2001 From: Yugantkamane <99096203+Yugantkamane@users.noreply.github.com> Date: Fri, 13 May 2022 17:42:52 +0530 Subject: [PATCH] I want to create the jenkins file --- jenkinsfile | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 jenkinsfile diff --git a/jenkinsfile b/jenkinsfile new file mode 100644 index 00000000..e3ec8701 --- /dev/null +++ b/jenkinsfile @@ -0,0 +1,21 @@ +node { + def commit_id + stage('Preparation') { + checkout scm + sh "git rev-parse --short HEAD > .git/commit-id" + commit_id = readFile('.git/commit-id').trim() + } + + stage('docker build/push') { + docker.withRegistry('https://index.docker.io/v2/', 'dockerhub') { + def app = docker.build("yugant1/docker-nodejs-demo", '.').push() + } + } + stage('deploy') { + sh """ + docker run -p 3000:3000 -d --name my-nodejs-app yugant1/docker-nodejs-demo + """ + + } + +}