Commit 6806f359 authored by Kunkka王辉's avatar Kunkka王辉 😲

feat: 环境配置

parent aecdf45b
# ~/.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 \[\033[0;36m\]\W\[\033[0m\]\[\033[0;32m\]\$(git-branch-prompt)\[\033[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 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
......@@ -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
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
......
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端口
......
#部署的env全部,用来追加到 项目的.env 文件用来支持每个服务之间的调用
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment