Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Q
qg-dockerfiles
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
QA
qg-dockerfiles
Commits
06960d0e
Commit
06960d0e
authored
Dec 14, 2018
by
tong.li
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of git.quantgroup.cn:QA/qg-dockerfiles
parents
6e119abf
f1076f6b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
1 addition
and
99 deletions
+1
-99
Dockerfile
templates/lua-ui/Dockerfile
+1
-5
replace.py
templates/lua-ui/replace.py
+0
-60
replace_config.yaml
templates/lua-ui/replace_config.yaml
+0
-34
No files found.
templates/lua-ui/Dockerfile
View file @
06960d0e
...
...
@@ -14,12 +14,8 @@ RUN echo -e "${BUILD_SCHEMA//@/\n}" >> ./build_info
COPY
nginx.conf /usr/local/openresty/nginx/conf/nginx.conf
COPY
*.vh.conf /usr/local/openresty/nginx/conf/conf.d/
COPY
*.lua /usr/local/openresty/nginx/lua/
COPY
*tgz .
COPY
docker-entrypoint.sh .
COPY
*tgz ./
COPY
replace_config.yaml .
COPY
replace.py .
RUN
chmod
+x ./docker-entrypoint.sh
CMD
./docker-entrypoint.sh
\ No newline at end of file
templates/lua-ui/replace.py
deleted
100644 → 0
View file @
6e119abf
# coding=UTF-8
from
__future__
import
print_function
import
io
import
yaml
import
fileinput
import
os
import
os.path
import
re
import
copy
f
=
io
.
open
(
'replace_config.yaml'
,
'r'
,
encoding
=
'utf-8'
)
res
=
yaml
.
load
(
f
)
print
(
"全部配置信息:"
,
res
)
# 查看配置中是否有当前项目
env
=
os
.
environ
project
=
env
.
get
(
'SYSTEM_NAME'
)
distPath
=
os
.
path
.
abspath
(
project
+
'/dist'
)
config
=
res
.
get
(
project
,
res
.
get
(
'common'
))
print
(
project
,
"的配置信息:"
,
config
)
print
(
"dist路径:"
,
distPath
)
# 根据内容进行替换
namespace
=
env
.
get
(
'NAMESPACE'
)
print
(
'namespace:'
,
namespace
)
files
=
[]
acceptType
=
{
'.html'
,
'.js'
,
'.css'
}
def
findFile
(
dir
):
if
os
.
path
.
isfile
(
dir
):
suffix
=
os
.
path
.
splitext
(
dir
)[
-
1
]
if
(
suffix
in
acceptType
):
files
.
append
(
dir
)
return
else
:
for
sub
in
os
.
listdir
(
dir
):
findFile
(
dir
+
'/'
+
sub
)
# 过滤符合要求的文件路径
findFile
(
distPath
)
# 替换文件中的内容
for
file
in
files
:
for
line
in
fileinput
.
input
(
file
,
inplace
=
1
):
for
item
in
config
:
if
not
config
[
item
]:
continue
rule
=
copy
.
deepcopy
(
config
[
item
])
if
rule
.
get
(
'useNamespace'
,
None
)
and
rule
[
'to'
]:
rule
[
'to'
]
=
'-'
+
namespace
+
rule
[
'to'
]
if
rule
[
'reg'
]:
p
=
re
.
compile
(
r''
+
rule
[
'reg'
])
line
=
re
.
sub
(
p
,
rule
[
'to'
],
line
)
print
(
line
,
end
=
''
)
fileinput
.
close
()
f
.
close
()
\ No newline at end of file
templates/lua-ui/replace_config.yaml
deleted
100644 → 0
View file @
6e119abf
# reg: 匹配的正则
# to: 正则匹配后替换需要的值
# useNamespace: 是否在替换的值前追加 '-[namespace名称]'
lkbDomain
:
&lkbDomain
'
.liangkebang.com'
# 替换xyqbapi
xyqbApiRule
:
&xyqbApiRule
reg
:
'
(?<=\w).xyqb.com'
to
:
*lkbDomain
useNamespace
:
true
# 替换cookie,需要放在api规则后;或者需要改正则
xyqbCookieRule
:
&xyqbCookieRule
reg
:
'
.xyqb.com'
to
:
*lkbDomain
qgApiRule
:
&qgApiRule
reg
:
'
(?<=\w).q-gp.com'
to
:
*lkbDomain
useNamespace
:
true
# todo: 看哪个项目需要
h5AuthRule
:
&h5AuthRule
reg
:
'
h5.auth.quantgroup.cn'
to
:
'
operator.liangkebang.com'
# todo: quantgroup.cn
common
:
&common
xyqbApiRule
:
*xyqbApiRule
qgApiRule
:
*qgApiRule
xyqbCookieRule
:
*xyqbCookieRule
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