forked from Training-241209/nottumblr-frontend-team4
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJenkinsfile
More file actions
24 lines (22 loc) · 631 Bytes
/
Copy pathJenkinsfile
File metadata and controls
24 lines (22 loc) · 631 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
pipeline {
agent any
environment {
DOCKER_IMAGE = 'nottumblr-frontend'
DOCKER_TAG = "${BUILD_NUMBER}"
}
stages {
stage('Docker Build') {
steps {
sh "docker build --no-cache -t ${DOCKER_IMAGE}:${DOCKER_TAG} ."
}
}
stage('Docker Run') {
steps {
// Stop & remove old container if needed
sh "docker stop ${DOCKER_IMAGE} || true"
sh "docker rm ${DOCKER_IMAGE} || true"
sh "docker run -d -p 8082:80 --name ${DOCKER_IMAGE} ${DOCKER_IMAGE}:${DOCKER_TAG}"
}
}
}
}