-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJenkinsfile
More file actions
38 lines (33 loc) · 1.16 KB
/
Copy pathJenkinsfile
File metadata and controls
38 lines (33 loc) · 1.16 KB
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
38
pipeline {
agent any
stages {
stage('制品'){
steps {
// some block
sh 'ls -al'
sh 'tar -zcvf openai.tar.gz *'
archiveArtifacts artifacts: 'openai.tar.gz',
allowEmptyArchive: true,
fingerprint: true,
onlyIfSuccessful: true
sh 'ls -al'
}
}
stage('部署'){
steps {
sh 'ls -al'
writeFile file: 'Dockerfile',
text: '''FROM nginx
ADD openai.tar.gz /usr/share/nginx/html/
RUN rm -f /etc/nginx/conf.d/default.conf
RUN mv /usr/share/nginx/html/nginx.conf /etc/nginx/conf.d/default.conf
'''
sh 'cat Dockerfile'
sh 'docker build -f Dockerfile -t openai-app:latest .'
sh 'docker rm -f openai-app'
//推送到私有库中
sh 'docker run -d -p 32506:80 --name openai-app openai-app:latest'
}
}
}
}