From f64adc211430a668021833f53a14db978f71c04e Mon Sep 17 00:00:00 2001 From: mouyong Date: Fri, 9 Aug 2019 08:52:32 +0800 Subject: [PATCH] workspace and php-fpm change source --- docker-compose.yml | 5 +++++ mysql/my.cnf | 8 +++++++- .../sites/{default.conf => default.conf.example} | 0 php-fpm/Dockerfile | 10 ++++++++++ php-fpm/debian.sources.list | 8 ++++++++ php-fpm/xdebug.ini | 9 +++++++-- workspace/Dockerfile | 9 +++++++++ workspace/ubuntu.sources.list | 15 +++++++++++++++ workspace/xdebug.ini | 9 +++++++-- 9 files changed, 68 insertions(+), 5 deletions(-) rename nginx/sites/{default.conf => default.conf.example} (100%) create mode 100644 php-fpm/debian.sources.list create mode 100644 workspace/ubuntu.sources.list diff --git a/docker-compose.yml b/docker-compose.yml index 462b085..2b9bff3 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -55,6 +55,7 @@ services: build: context: ./workspace args: + - CHANGE_SOURCE=${CHANGE_SOURCE} - LARADOCK_PHP_VERSION=${PHP_VERSION} - LARADOCK_PHALCON_VERSION=${PHALCON_VERSION} - INSTALL_SUBVERSION=${WORKSPACE_INSTALL_SUBVERSION} @@ -126,6 +127,7 @@ services: - no_proxy volumes: - ${APP_CODE_PATH_HOST}:${APP_CODE_PATH_CONTAINER}${APP_CODE_CONTAINER_FLAG} + - "./workspace/crontab/laradock:/etc/cron.d/laradock" extra_hosts: - "dockerhost:${DOCKER_HOST_IP}" ports: @@ -145,6 +147,7 @@ services: build: context: ./php-fpm args: + - CHANGE_SOURCE=${CHANGE_SOURCE} - LARADOCK_PHP_VERSION=${PHP_VERSION} - LARADOCK_PHALCON_VERSION=${PHALCON_VERSION} - INSTALL_XDEBUG=${PHP_FPM_INSTALL_XDEBUG} @@ -200,6 +203,7 @@ services: - "9000" extra_hosts: - "dockerhost:${DOCKER_HOST_IP}" + dns: 114.114.114.114 environment: - PHP_IDE_CONFIG=${PHP_IDE_CONFIG} - DOCKER_HOST=tcp://docker-in-docker:2375 @@ -211,6 +215,7 @@ services: links: - docker-in-docker + ### PHP Worker ############################################ php-worker: build: diff --git a/mysql/my.cnf b/mysql/my.cnf index 68578ef..a7facd5 100644 --- a/mysql/my.cnf +++ b/mysql/my.cnf @@ -6,5 +6,11 @@ [mysql] [mysqld] -sql-mode="STRICT_TRANS_TABLES,NO_ZERO_DATE,NO_ZERO_IN_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION" +sql-mode="STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ZERO_DATE,NO_ZERO_IN_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION" character-set-server=utf8mb4 +skip-name-resolve +symbolic-links=0 +explicit_defaults_for_timestamp +default_authentication_plugin=mysql_native_password +#skip-grant-tables=1 + diff --git a/nginx/sites/default.conf b/nginx/sites/default.conf.example similarity index 100% rename from nginx/sites/default.conf rename to nginx/sites/default.conf.example diff --git a/php-fpm/Dockerfile b/php-fpm/Dockerfile index 68a1933..183bd3c 100644 --- a/php-fpm/Dockerfile +++ b/php-fpm/Dockerfile @@ -24,6 +24,16 @@ ARG LARADOCK_PHP_VERSION # Set Environment Variables ENV DEBIAN_FRONTEND noninteractive +# If you're in China, or you need to change sources, will be set CHANGE_SOURCE to true in .env. + +ADD debian.sources.list /etc/apt/debian.sources.list +ARG CHANGE_SOURCE=false +RUN if [ ${CHANGE_SOURCE} = true ]; then \ + mv /etc/apt/sources.list /etc/apt/sources.list.back && \ + mv /etc/apt/debian.sources.list /etc/apt/sources.list \ +;fi + + # always run apt update when start and after add new source list, then clean up at end. RUN set -xe; \ apt-get update -yqq && \ diff --git a/php-fpm/debian.sources.list b/php-fpm/debian.sources.list new file mode 100644 index 0000000..4cf4976 --- /dev/null +++ b/php-fpm/debian.sources.list @@ -0,0 +1,8 @@ +deb http://mirrors.aliyun.com/debian/ stretch main non-free contrib +deb-src http://mirrors.aliyun.com/debian/ stretch main non-free contrib +deb http://mirrors.aliyun.com/debian-security stretch/updates main +deb-src http://mirrors.aliyun.com/debian-security stretch/updates main +deb http://mirrors.aliyun.com/debian/ stretch-updates main non-free contrib +deb-src http://mirrors.aliyun.com/debian/ stretch-updates main non-free contrib +deb http://mirrors.aliyun.com/debian/ stretch-backports main non-free contrib +deb-src http://mirrors.aliyun.com/debian/ stretch-backports main non-free contrib \ No newline at end of file diff --git a/php-fpm/xdebug.ini b/php-fpm/xdebug.ini index c3f32ec..42a7c9b 100644 --- a/php-fpm/xdebug.ini +++ b/php-fpm/xdebug.ini @@ -5,14 +5,19 @@ xdebug.remote_connect_back=1 xdebug.remote_port=9000 xdebug.idekey=PHPSTORM -xdebug.remote_autostart=0 +xdebug.remote_autostart=1 xdebug.remote_enable=0 -xdebug.cli_color=0 +xdebug.cli_color=1 xdebug.profiler_enable=0 xdebug.profiler_output_dir="~/xdebug/phpstorm/tmp/profiling" xdebug.remote_handler=dbgp xdebug.remote_mode=req +xdebug.remote_log=/var/log/php/xdebug_remote.log + +xdebug.auto_trace = 1 +xdebug.collect_params = 1 +xdebug.collect_return = 1 xdebug.var_display_max_children=-1 xdebug.var_display_max_data=-1 diff --git a/workspace/Dockerfile b/workspace/Dockerfile index cbbeb2e..fa2ea64 100644 --- a/workspace/Dockerfile +++ b/workspace/Dockerfile @@ -24,6 +24,15 @@ ARG LARADOCK_PHP_VERSION # Set Environment Variables ENV DEBIAN_FRONTEND noninteractive +# If you're in China, or you need to change sources, will be set CHANGE_SOURCE to true in .env. + +ADD ubuntu.sources.list /etc/apt/ubuntu.sources.list +ARG CHANGE_SOURCE=false +RUN if [ ${CHANGE_SOURCE} = true ]; then \ + mv /etc/apt/sources.list /etc/apt/sources.list.back && \ + mv /etc/apt/ubuntu.sources.list /etc/apt/sources.list \ +;fi + # Start as root USER root diff --git a/workspace/ubuntu.sources.list b/workspace/ubuntu.sources.list new file mode 100644 index 0000000..6edaa13 --- /dev/null +++ b/workspace/ubuntu.sources.list @@ -0,0 +1,15 @@ +deb http://mirrors.aliyun.com/ubuntu/ xenial main +deb-src http://mirrors.aliyun.com/ubuntu/ xenial main + +deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main +deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates main + +deb http://mirrors.aliyun.com/ubuntu/ xenial universe +deb-src http://mirrors.aliyun.com/ubuntu/ xenial universe +deb http://mirrors.aliyun.com/ubuntu/ xenial-updates universe +deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates universe + +deb http://mirrors.aliyun.com/ubuntu/ xenial-security main +deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security main +deb http://mirrors.aliyun.com/ubuntu/ xenial-security universe +deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security universe \ No newline at end of file diff --git a/workspace/xdebug.ini b/workspace/xdebug.ini index c3f32ec..42a7c9b 100644 --- a/workspace/xdebug.ini +++ b/workspace/xdebug.ini @@ -5,14 +5,19 @@ xdebug.remote_connect_back=1 xdebug.remote_port=9000 xdebug.idekey=PHPSTORM -xdebug.remote_autostart=0 +xdebug.remote_autostart=1 xdebug.remote_enable=0 -xdebug.cli_color=0 +xdebug.cli_color=1 xdebug.profiler_enable=0 xdebug.profiler_output_dir="~/xdebug/phpstorm/tmp/profiling" xdebug.remote_handler=dbgp xdebug.remote_mode=req +xdebug.remote_log=/var/log/php/xdebug_remote.log + +xdebug.auto_trace = 1 +xdebug.collect_params = 1 +xdebug.collect_return = 1 xdebug.var_display_max_children=-1 xdebug.var_display_max_data=-1