-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
37 lines (32 loc) · 1016 Bytes
/
Jenkinsfile
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
26
27
28
29
30
31
32
33
34
35
36
37
pipeline {
agent any
environment {
DOCKER_IMAGE = "my-django-app:latest"
DOCKER_CONTAINER = "my-django-container"
}
stages {
stage('Checkout') {
steps {
sh 'git pull https://github.com/viper-18/cv-site.git'
// #git branch: 'main', url: 'https://github.com/viper-18/cv-site.git'
}
}
stage('Build Docker Image') {
steps {
script {
sh "docker build -t ${DOCKER_IMAGE} ."
// def customImage = docker.build(DOCKER_IMAGE, '.')
}
}
}
stage('Run Docker Container') {
steps {
script {
sh "docker stop ${DOCKER_CONTAINER} || true"
sh "docker rm ${DOCKER_CONTAINER} || true"
sh "docker run -itd -p 8000:8000 --name ${DOCKER_CONTAINER} ${DOCKER_IMAGE}"
}
}
}
}
}