forked from 2206-devops-batch/MonikaiT-project1
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
28 lines (28 loc) · 1001 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
pipeline {
agent {label ''}
stages {
stage('Test, Build, Archive') {
agent { label '' }
steps {
sh 'pwd'
sh 'ls'
sh 'sudo yum –y install python3'
sh 'sudo yum -y install docker'
sh 'sudo yum –y install python3-pip'
sh 'pip3 install -r requirements.txt'
sh 'python3 -m pytest app-test.py'
sh 'sudo docker login -u ${DOCK_USER} --password-stdin ${DOCK_PASSWORD}'
sh 'sudo docker build /home/ec2-user/workspace/Monikai -t chamoo334/p2'
sh 'sudo docker push chamoo334/p2'
}
}
stage('Run') {
agent { label '' }
steps {
sh 'sudo docker system prune -af'
sh 'sudo docker pull chamoo334/p2:latest'
sh 'sudo docker run -p 5000:5000 -d --name p2_app chamoo334/p2'
}
}
}
}