Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
W
wuye-monitor
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
郭铭瑶
wuye-monitor
Commits
76e314e9
Commit
76e314e9
authored
Jan 10, 2020
by
蔡漂平
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
devops
parent
009deb74
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
70 additions
and
0 deletions
+70
-0
Jenkinsfile
Jenkinsfile
+54
-0
nginx.conf
nginx.conf
+16
-0
No files found.
Jenkinsfile
0 → 100644
View file @
76e314e9
#
!
/usr/
bin
/
groovy
@Library
(
'pipeline-library'
)
def
utils
=
new
io
.
fabric8
.
Utils
()
clientsNode
{
def
env
=
'shanghaiwuye'
def
projectName
=
"${JOB_BASE_NAME}"
def
newVersion
=
''
def
deployType
=
""
try
{
deployType
=
DEPLOY_TYPE
}
catch
(
Throwable
e
)
{
deployType
=
"TEST"
}
checkout
scm
stage
'构建版本'
echo
'NOTE: running pipelines for the first time will take longer as build and base docker images are pulled onto the node'
if
(!
fileExists
(
'Dockerfile'
))
{
writeFile
file:
'Dockerfile'
,
text:
'''FROM 168.168.112.64:5000/node-nginx:8.12.0
WORKDIR /app
# 将当前目录下的所有文件拷贝到工作目录下
COPY . /app/
# 1.安装依赖
# 2.运行 npm run build
# 3.将 dist 目录的所有文件拷贝到 nginx 的目录下
# 4.删除工作目录的文件,尤其是 node_modules 以减小镜像体积
# 由于镜像构建的每一步都会产生新层
# 为了减小镜像体积,尽可能将一些同类操作,集成到一个步骤中,如下、
RUN cp -r dist/* /var/www/html \\
&& cp nginx.conf /etc/nginx/conf.d \\
'''
}
newVersion
=
performCanaryRelease
{}
def
rc
=
getKubernetesJson
{
port
=
80
label
=
'nodejs'
version
=
newVersion
name
=
projectName
imageName
=
clusterImageName
}
stage
'部署'
kubernetesApply
(
file:
rc
,
environment:
env
)
}
nginx.conf
0 → 100644
View file @
76e314e9
server
{
listen
80
;
server_name
localhost
;
#vue项目的打包后的dist
root
/var/www/html
;
location
/
{
try_files
$uri
$uri
/
@router
;
#需要指向下面的@router否则会出现vue的路由在nginx中刷新出现404
index
index.html
index.htm
;
}
#对应上面的@router,主要原因是路由的路径资源并不是一个真实的路径,所以无法找到具体的文件
#因此需要rewrite到index.html中,然后交给路由在处理请求资源
location
@router
{
rewrite
^.*
$
/index.html
last
;
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment