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
6806f359
Commit
6806f359
authored
Sep 12, 2023
by
Kunkka王辉
😲
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 环境配置
parent
aecdf45b
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
484 additions
and
48 deletions
+484
-48
.bashrc
.bashrc
+35
-0
.env.example
.env.example
+4
-1
docker-compose.yaml
docker-compose.yaml
+31
-8
Dockerfile-nginx
src/Dockerfile-nginx
+19
-31
Dockerfile-php
src/Dockerfile-php
+5
-8
deploy-env
src/deploy-env
+1
-0
deploy-hosts.sh
src/deploy-hosts.sh
+389
-0
No files found.
.bashrc
0 → 100644
View file @
6806f359
# ~/.bashrc: executed by bash(1) for non-login shells.
# Source global definitions
if
[
-f
/etc/bashrc
]
;
then
.
/etc/bashrc
fi
alias
ll
=
'ls -alF'
alias
la
=
'ls -A'
alias
l
=
'ls -CF'
alias rm
=
'rm -i'
alias cp
=
'cp -i'
alias mv
=
'mv -i'
if
[
-f
~/.bash_aliases
]
;
then
.
~/.bash_aliases
fi
function
git-branch-name
{
git symbolic-ref
--short
-q
HEAD 2>/dev/null |
cut
-d
"/"
-f
3
}
function
git-branch-prompt
{
local
branch
=
`
git-branch-name
`
if
[
$branch
]
;
then
printf
" [%s]"
$branch
;
fi
}
PS1
=
"
\u
@
\h
\[\0
33[0;36m
\]\W\[\0
33[0m
\]\[\0
33[0;32m
\]\$
(git-branch-prompt)
\[\0
33[0m
\]
\$
"
function
php7
()
{
docker run
--rm
-it
--network
galaxy-net
-v
$(
pwd
)
:/app galaxy-php:7.4 php
"
$@
"
}
function
composer
()
{
docker run
--rm
-it
--network
galaxy-net
-v
$(
pwd
)
:/app galaxy-php:7.4 composer
"
$@
"
}
.env.example
View file @
6806f359
# 环境变量env dev,test,test1,test2等区分
ENV=dev
PORT=8118
\ No newline at end of file
# 服务宿主机的端口
PORT=80
# 代码目录,含前后端
CODE_DIR=/home/wh/workplace/code_test
\ No newline at end of file
docker-compose.yaml
View file @
6806f359
...
...
@@ -5,22 +5,45 @@ services:
context
:
src
dockerfile
:
Dockerfile-php
image
:
galaxy-php:7.4
container_name
:
galaxy-php7.4${ENV:-dev}
# environment
:
#目录映射
container_name
:
galaxy-php7.4
-
${ENV:-dev}
volumes
:
-
${CODE_DIR}:/var/www
expose
:
-
9000
networks
:
-
galaxy-net
nginx
:
build
:
context
:
src
dockerfile
:
Dockerfile-nginx
# 目录共享
# 指定目录映射
#
args
:
-
PHP_HOST=galaxy-php7.4-${ENV:-dev}
-
HOST=nginx-${ENV:-dev}
-
DWP_HTTP_PORT=8081
-
OLD_CRM_HTTP_PORT=8181
-
OLD_CRM_CLIENT_HTTP_PORT=8290
-
OLD_CRM_USER_HTTP_PORT=8291
-
OLD_CRM_ADMIN_HTTP_PORT=9191
-
GALAXY_CRM_API_HTTP_PORT=9101
-
GALAXY_FLOW_MICROS_API_HTTP_PORT=9102
-
GALAXY_SERVER_SITE_API_HTTP_PORT=9103
-
GALAXY_USER_MICROS_API_HTTP_PORT=9104
-
GALAXY_PRESALE_MICROS_API_HTTP_PORT=9105
-
GALAXY_MICROS_GATEWAY_API_HTTP_PORT=9106
-
GALAXY_ENTRY_API_HTTP_PORT=9107
-
GALAXY_WORKFLOW_API_HTTP_PORT=9108
-
GALAXY_COMMON_SERVER_API_HTTP_PORT=9109
-
VUE_USERINFO_PORT=9169
image
:
galaxy-nginx
container_name
:
nginx-test${ENV:-dev}
container_name
:
nginx-${ENV:-dev}
networks
:
-
galaxy-net
expose
:
-
80
ports
:
-
"
${PORT:-8118}:80"
command
:
[
"
nginx"
,
"
-g"
,
"
daemon
off;"
]
\ No newline at end of file
command
:
[
"
nginx"
,
"
-g"
,
"
daemon
off;"
]
networks
:
galaxy-net
:
name
:
galaxy-net
driver
:
bridge
\ No newline at end of file
src/Dockerfile-nginx
View file @
6806f359
FROM nginx:latest
## 初始化参数
ARG HOST
ARG PHP_HOST
ARG DWP_HTTP_PORT
ARG OLD_CRM_HTTP_PORT
ARG OLD_CRM_CLIENT_HTTP_PORT
ARG OLD_CRM_USER_HTTP_PORT
ARG OLD_CRM_ADMIN_HTTP_PORT
ARG GALAXY_CRM_API_HTTP_PORT
ARG GALAXY_FLOW_MICROS_API_HTTP_PORT
ARG GALAXY_SERVER_SITE_API_HTTP_PORT
ARG GALAXY_USER_MICROS_API_HTTP_PORT
ARG GALAXY_PRESALE_MICROS_API_HTTP_PORT
ARG GALAXY_MICROS_GATEWAY_API_HTTP_PORT
ARG GALAXY_ENTRY_API_HTTP_PORT
ARG GALAXY_WORKFLOW_API_HTTP_PORT
ARG GALAXY_COMMON_SERVER_API_HTTP_PORT
ARG VUE_USERINFO_PORT
ENTRYPOINT ["/docker-entrypoint.sh"]
RUN mkdir /etc/nginx/php
COPY <<EOF /etc/nginx/php/php7.4.conf
location ~ \.php$ {
fastcgi_pass php7.4:9000;
include fastcgi_params;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME \$document_root\$fastcgi_script_name;
}
EOF
COPY <<EOF /etc/nginx/conf.d/default.conf
server {
listen 80;
server_name localhost;
root /app/www;
index index.php index.html index.htm;
location / {
proxy_ignore_client_abort on;
fastcgi_ignore_client_abort on;
try_files \$uri \$uri/ /index.php?\$query_string;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
include /etc/nginx/php/php7.4.conf;
}
EOF
RUN cat /etc/nginx/conf.d/default.conf
COPY deploy-hosts.sh /app/deploy-hosts.sh
RUN chmod +x /app/deploy-hosts.sh && /app/deploy-hosts.sh
EXPOSE 80
STOPSIGNAL SIGQUIT
...
...
src/Dockerfile-php
View file @
6806f359
FROM phpdockerio/php74-cli
#
安装所需的依赖,以及清理临时文件
#
apt 国内镜像
COPY <<EOF /etc/apt/sources.list
deb https://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
...
...
@@ -11,7 +11,7 @@ deb-src https://mirrors.aliyun.com/ubuntu/ focal-updates main restricted univers
deb https://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
EOF
# 安装扩展
RUN apt-get update && \
apt-get -y install php7.4-common php7.4-mysql php7.4-pgsql php7.4-mysqlnd php7.4-gd php7.4-bcmath php7.4-soap php7.4-sqlite3 php7.4-redis php7.4-fpm php7.4-gd php7.4-bcmath php7.4-mongodb php7.4-tidy php7.4-protobuf \
php7.4-rdkafka php7.4-tideways php7.4-imap php7.4-imagick php7.4-swoole php7.4-xmlrpc php7.4-intl php-pear
...
...
@@ -28,14 +28,11 @@ RUN sed -i 's/^listen\s=.*sock/listen = 0.0.0.0:9000/g' /etc/php/7.4/fpm/pool.d/
# 设置工作目录
WORKDIR /app
RUN mkdir /app/www
COPY
<<
EOF
/
app
/
www
/
index
.
php
<?
php
phpinfo
();
EOF
COPY
check
.
sh
/
app
/
# 检查扩展是否安装完整
RUN
chmod
+
x
/
app
/
check
.
sh
&&
/
app
/
check
.
sh
COPY check.sh /app/
RUN chmod +x /app/check.sh && /app/check.sh && rm -f /app/check.sh
# 指定容器启动时执行的命令
CMD ["/usr/sbin/php-fpm7.4","--nodaemonize", "-O"]
# 暴露9000端口
...
...
src/deploy-env
0 → 100644
View file @
6806f359
#部署的env全部,用来追加到 项目的.env 文件用来支持每个服务之间的调用
src/deploy-hosts.sh
0 → 100644
View file @
6806f359
This diff is collapsed.
Click to expand it.
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