-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJenkinsfile
More file actions
25 lines (25 loc) · 717 Bytes
/
Copy pathJenkinsfile
File metadata and controls
25 lines (25 loc) · 717 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
25
pipeline {
agent any
environment {
PORT = '8080'
EXTERNAL_PORT = '8080'
DOCKER_TAG = 'challenge-bitcoin-api'
}
stages {
stage('Build') {
steps {
echo 'Building...'
sh 'docker build -t $DOCKER_TAG .'
}
}
stage('Deploy') {
steps {
echo 'Stopping previous version...'
sh 'docker stop $DOCKER_TAG || echo Nothing to stop'
sh 'docker rm $DOCKER_TAG || echo Nothing to remove'
echo 'Deploying...'
sh 'docker run -d -e PORT -p $EXTERNAL_PORT:$PORT --name $DOCKER_TAG $DOCKER_TAG'
}
}
}
}