Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
docker-test
Project
Project
Details
Activity
Releases
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
Kunkka王辉
docker-test
Commits
6137f736
Commit
6137f736
authored
Sep 22, 2023
by
Kunkka王辉
😲
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
安装脚本优化
parent
97b029c3
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
55 additions
and
11 deletions
+55
-11
.bashrc
.bashrc
+9
-1
docker-compose.yaml
docker-compose.yaml
+1
-1
install.sh
install.sh
+42
-8
Dockerfile-php
src/Dockerfile-php
+2
-0
nginx-start.sh
src/nginx-start.sh
+1
-1
No files found.
.bashrc
View file @
6137f736
...
...
@@ -36,11 +36,19 @@ PS1="\u@\h \[\033[0;36m\]\W\[\033[0m\]\[\033[0;32m\]\$(git-branch-prompt)\[\033[
function
php7
()
{
docker run
--rm
-it
--network
galaxy-net
-v
$(
pwd
)
:/app harbor.galaxy-immi.com/galaxy-open-develop/php:7.4 php
"
$@
"
docker run
--rm
-it
-e
LANG
=
"C.UTF-8"
-e
LC_ALL
=
"en_US.UTF-8"
--network
galaxy-net
-v
$(
pwd
)
:/app harbor.galaxy-immi.com/galaxy-open-develop/php:7.4 php
"
$@
"
}
function
php8
()
{
docker run
--rm
-it
-e
LANG
=
"C.UTF-8"
LANG
=
"en_US.UTF-8"
-e
LC_ALL
=
"en_US.UTF-8"
--network
galaxy-net
-v
$(
pwd
)
:/app harbor.galaxy-immi.com/galaxy-open-develop/php:8.0 php
"
$@
"
}
function
composer
()
{
docker run
--rm
-it
--network
galaxy-net
-v
$(
pwd
)
:/app harbor.galaxy-immi.com/galaxy-open-develop/php:7.4 composer
"
$@
"
}
function
mvn
()
{
docker run
--rm
--entrypoint
'mvn'
-v
$(
pwd
)
:/app/code
-w
/app/code
-v
maven-repo:/usr/share/maven/repo harbor.galaxy-immi.com/galaxy-open-develop/java:11
"
$@
"
}
docker-compose.yaml
View file @
6137f736
...
...
@@ -69,7 +69,7 @@ services:
ports
:
-
"
${PORT:-8118}:8081"
-
"
${PORT_CRM:-8181}:8181"
-
"
8290
:8290"
# 老crm 转发
-
"
${PORT_CRM_CLIENT:-8290}
:8290"
# 老crm 转发
restart
:
on-failure
java-notice
:
image
:
harbor.galaxy-immi.com/galaxy-open-develop/java:11
...
...
install.sh
View file @
6137f736
#!/bin/bash
# 获取本机ip 192 ip
HOST_IP
=
$(
hostname
-I
|
grep
-E
"192
\.
168
\.
[0-9]+
\.
[0-9]+"
-o
)
# CRM_PORT,DWP_PORT,CRM_CLIENT_PORT
CRM_PORT
=
8181
DWP_PORT
=
8118
CRM_CLIENT_PORT
=
8290
check_port
()
{
if
[[
$1
=
~ ^[0-9]+
$
]]
;
then
if
[
$1
-lt
49152
]
&&
[
$1
-gt
1023
]
;
then
return
0
fi
fi
return
1
}
#是否使用默认端口
printf
"是否使用默认端口:CRM:
$CRM_PORT
,DWP:
$DWP_PORT
,CRM_CLIENT:
$CRM_CLIENT_PORT
:[Y/N] "
;
read
x
;
if
[
$x
==
"N"
]
;
then
printf
"设置CRM_PORT【当前8181】:"
&&
read
CRM_PORT
check_port
$CRM_PORT
||
echo
"CRM_PORT必须是整数范围[1024-49152]"
||
exit
printf
"设置DWP_PORT【当前8118】:"
&&
read
DWP_PORT
check_port
$DWP_PORT
||
echo
"DWP_PORT必须是整数[1024-49152]"
||
exit
printf
"设置CRM_CLIENT_PORT 【当前8290】:"
&&
read
CRM_CLIENT_PORT
check_port
$CRM_CLIENT_PORT
||
echo
"CRM_CLIENT_PORT必须是整数[1024-49152]"
||
exit
fi
OS_IS_LINUX
=
'yes'
if
[
$(
uname
-o
)
!=
"GNU/Linux"
]
;
then
OS_IS_LINUX
=
'no'
;
fi
DOCKER_YES
=
'yes'
...
...
@@ -17,7 +44,7 @@ fi
DOCKER_COMPOSE_YES
=
'yes'
if
[
!
$(
command
-v
docker-compose
)
]
&&
[
"
$COMPOSE_CMD
"
!=
'docker compose'
]
;
then
DOCKER_COMPOSE_YES
=
'no'
;
fi
PORT_YES
=
'yes'
if
ss
-tpl
|
grep
-E
'8118|8181'
>
/dev/null
;
then
PORT_YES
=
'no'
;
fi
if
ss
-tpl
|
grep
-E
"
$CRM_PORT
|
$DWP_PORT
|
$CRM_CLIENT_PORT
"
>
/dev/null
;
then
PORT_YES
=
'no'
;
fi
cat
<<
EOF
检查环境:
1. 是否是linux系统
$OS_IS_LINUX
...
...
@@ -25,7 +52,7 @@ cat <<EOF
3. git
$GIT_YES
4. docker-compose/docker compose
$DOCKER_COMPOSE_YES
5. tar
$TAR_YES
6. 端口
8118,8181
是否可用
$PORT_YES
6. 端口
$CRM_PORT
,
$DWP_PORT
,
$CRM_CLIENT_PORT
是否可用
$PORT_YES
8. 本机IP
$HOST_IP
EOF
if
echo
"
$TAR_YES$GIT_YES$DOCKER_COMPOSE_YES$OS_IS_LINUX$DOCKER_YES$PORT_YES
"
|
grep
no
>
/dev/null
;
then
...
...
@@ -54,9 +81,15 @@ rm -f data.tgz
echo
'storage 目录权限处理'
find ./
-type
d
-name
'storage'
-exec
chmod
-R
0777
{}
+
cd
$CODE_DIR
/crm
grep
-rlZ
192.168.11.163 ./ | xargs
-0
sed
-i
"s/192.168.11.163/
$HOST_IP
/g"
grep
-rlZ
192.168.11.163:8118 ./ | xargs
-0
sed
-i
"s/192.168.11.163:8118/
$HOST_IP
:
$DWP_PORT
/g"
grep
-rlZ
192.168.11.163:8181 ./ | xargs
-0
sed
-i
"s/192.168.11.163:8181/
$HOST_IP
:
$CRM_PORT
/g"
grep
-rlZ
192.168.11.163:8290 ./ | xargs
-0
sed
-i
"s/192.168.11.163:8290/
$HOST_IP
:
$CRM_CLIENT_PORT
/g"
cd
$CODE_DIR
/dwp/main
grep
-rlZ
192.168.11.163 ./ | xargs
-0
sed
-i
"s/192.168.11.163/
$HOST_IP
/g"
grep
-rlZ
192.168.11.163:8118 ./ | xargs
-0
sed
-i
"s/192.168.11.163:8118/
$HOST_IP
:
$DWP_PORT
/g"
grep
-rlZ
192.168.11.163:8181 ./ | xargs
-0
sed
-i
"s/192.168.11.163:8181/
$HOST_IP
:
$CRM_PORT
/g"
grep
-rlZ
192.168.11.163:8290 ./ | xargs
-0
sed
-i
"s/192.168.11.163:8290/
$HOST_IP
:
$CRM_CLIENT_PORT
/g"
cd
$CODE_DIR
/../
git clone http://gitlab.galaxy-immi.com/kunkka.wh/docker-test.git
$BUILD_DIR
cd
$BUILD_DIR
...
...
@@ -64,8 +97,9 @@ cat <<EOF >.env
# 环境变量env dev,test,test1,test2等区分
ENV=
$ENV
# 服务宿主机的端口
PORT=8118
PORT_CRM=8181
PORT=
$DWP_PORT
PORT_CRM=
$CRM_PORT
PORT_CRM_CLIENT=
$CRM_CLIENT_PORT
# 代码目录,含前后端
CODE_DIR=
$CODE_DIR
JAVA_PROFILE=innerdev # java需要根据环境调整
...
...
@@ -79,7 +113,7 @@ $COMPOSE_CMD up -d
cat
<<
EOF
本地访问地址
http://
$HOST_IP
:
8118
/ DWP
http://
$HOST_IP
:
8181
/ CRM
http://
$HOST_IP
:
$DWP_PORT
/ DWP
http://
$HOST_IP
:
$CRM_PORT
/ CRM
安装完成!
EOF
src/Dockerfile-php
View file @
6137f736
FROM phpdockerio/php74-cli
ENV TZ=Asia/Shanghai
ENV LANG=C.UTF-8
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
# apt 国内镜像
COPY sources.list /etc/apt/sources.list
...
...
@@ -14,6 +15,7 @@ echo "extension=xlswriter.so" > /etc/php/7.4/mods-available/xlswriter.ini && ln
RUN apt-get remove --purge -y php7.4-dev php-pear build-essential && apt-get autoremove -y && \
apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/doc/* ~/.composer # buildkit
## 修改sock监听为ip端口
RUN sed -i 's/^listen\s=.*sock/listen = 0.0.0.0:9000/g' /etc/php/7.4/fpm/pool.d/www.conf && \
cat /etc/php/7.4/fpm/pool.d/www.conf | grep -v ';' | grep -v -e '^$'
...
...
src/nginx-start.sh
View file @
6137f736
...
...
@@ -123,7 +123,7 @@ server {
}
location ^~ /newsystem/ {
proxy_pass http://
middle-platform.galaxy-immi.com:8291
/;
proxy_pass http://
$HOST
:
$OLD_CRM_USER_HTTP_PORT
/;
}
#禁止访问的文件或目录
...
...
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