-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjenkinsfile.txt
34 lines (29 loc) · 1.27 KB
/
jenkinsfile.txt
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
pipeline {
agent { label 'master' }
stages{
stage ('prep-clone') {
steps {
git url: "https://github.com/lavih/jenkins-python-server.git"
}
}
stage ('build&deploy') {
steps{
script {
def dockerfile_pythonserver = 'dockerfile-server.txt'
def customImage_pythonserver = docker.build("python-server:${env.BUILD_ID}", "-f ${dockerfile_pythonserver} .")
def dockerfile_pythonclient = 'dockerfile-client.txt'
def customImage_pythonclient = docker.build("python-client:${env.BUILD_ID}", "-f ${dockerfile_pythonclient} .")
}
}
}
stage ('test'){
steps {
script{
def DockerContainer_server = docker.image("python-server:${env.BUILD_ID}").withRun('--net lavih -v test:/test') {}
def DockerContainer_client = docker.image("python-client:${env.BUILD_ID}").withRun('--net lavih -v test:/test') {}
sh 'docker container run --name --net lavih -d "python-client:${env.BUILD_ID}"'
} //script
} //steps
} //stage
} //stages
} //pipeline