From 0b2af711622151261b99c65fa9c1993d9fae9640 Mon Sep 17 00:00:00 2001 From: richard Date: Thu, 19 Apr 2018 21:43:57 -0400 Subject: [PATCH] rework the composer and php images --- .../abcapi.xai-corp.net.conf | 11 +++++++- .../jenkins.xai-corp.net.conf | 3 +++ dockerfiles/tasks/composer/Dockerfile-71 | 1 + dockerfiles/tasks/composer/Dockerfile-72 | 2 +- dockerfiles/tasks/composer/build.sh | 8 ++++++ dockerfiles/tasks/dev-php7.0/Dockerfile-70 | 2 +- dockerfiles/tasks/dev-php7.0/Dockerfile-71 | 6 ++--- dockerfiles/tasks/dev-php7.0/Dockerfile-72 | 27 +++++++++++++++++++ .../tasks/dev-php7.0/Dockerfile-72-dev | 13 +++++++++ dockerfiles/tasks/dev-php7.0/build.sh | 12 +++++++++ 10 files changed, 79 insertions(+), 6 deletions(-) rename dockerfiles/services/sslproxy/{hosts-disabled => hosts}/abcapi.xai-corp.net.conf (71%) rename dockerfiles/services/sslproxy/{hosts-disabled => hosts}/jenkins.xai-corp.net.conf (84%) create mode 100644 dockerfiles/tasks/dev-php7.0/Dockerfile-72 create mode 100755 dockerfiles/tasks/dev-php7.0/Dockerfile-72-dev diff --git a/dockerfiles/services/sslproxy/hosts-disabled/abcapi.xai-corp.net.conf b/dockerfiles/services/sslproxy/hosts/abcapi.xai-corp.net.conf similarity index 71% rename from dockerfiles/services/sslproxy/hosts-disabled/abcapi.xai-corp.net.conf rename to dockerfiles/services/sslproxy/hosts/abcapi.xai-corp.net.conf index 8da57f3..3a29864 100644 --- a/dockerfiles/services/sslproxy/hosts-disabled/abcapi.xai-corp.net.conf +++ b/dockerfiles/services/sslproxy/hosts/abcapi.xai-corp.net.conf @@ -1,3 +1,12 @@ +proxy_cache_path /data/nginx/cache/abcapi levels=1:2 keys_zone=abcapi:10m max_size=10g + inactive=60m use_temp_path=off; + +upstream abcapi_upstream { + server tasks.abc-api_nginx:8084; + + server dkhost.xai-corp.net:8084 backup; +} + server { listen 443 ssl ipv6only=off; server_name abcapi.xai-corp.net; @@ -8,7 +17,7 @@ server { add_header Strict-Transport-Security "max-age=15768000; includeSubDomains" always; location / { - proxy_pass http://dkhost.xai-corp.net:8084; + proxy_pass http://abcapi_upstream; proxy_set_header Host $host; # required for docker client's sake proxy_set_header X-Real-IP $remote_addr; # pass on real client's IP proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; diff --git a/dockerfiles/services/sslproxy/hosts-disabled/jenkins.xai-corp.net.conf b/dockerfiles/services/sslproxy/hosts/jenkins.xai-corp.net.conf similarity index 84% rename from dockerfiles/services/sslproxy/hosts-disabled/jenkins.xai-corp.net.conf rename to dockerfiles/services/sslproxy/hosts/jenkins.xai-corp.net.conf index 5c8fa84..01fcc33 100644 --- a/dockerfiles/services/sslproxy/hosts-disabled/jenkins.xai-corp.net.conf +++ b/dockerfiles/services/sslproxy/hosts/jenkins.xai-corp.net.conf @@ -1,3 +1,6 @@ +proxy_cache_path /data/nginx/cache/jenkins levels=1:2 keys_zone=jenkins:10m max_size=10g + inactive=60m use_temp_path=off; + # jenkins.xai-corp.net server { listen 443 ssl; diff --git a/dockerfiles/tasks/composer/Dockerfile-71 b/dockerfiles/tasks/composer/Dockerfile-71 index ab992cf..a7a517a 100644 --- a/dockerfiles/tasks/composer/Dockerfile-71 +++ b/dockerfiles/tasks/composer/Dockerfile-71 @@ -17,6 +17,7 @@ RUN apt-get update && apt-get install -y software-properties-common python-softw php-pgsql php-redis \ \ && apt-cache pkgnames | grep php7.1 \ + && rm /usr/bin/php && ln -s /usr/bin/php7.1 /usr/bin/php \ && apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* \ && php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" \ && php composer-setup.php --install-dir=/usr/local/bin --filename=composer diff --git a/dockerfiles/tasks/composer/Dockerfile-72 b/dockerfiles/tasks/composer/Dockerfile-72 index e02c138..28e0f61 100644 --- a/dockerfiles/tasks/composer/Dockerfile-72 +++ b/dockerfiles/tasks/composer/Dockerfile-72 @@ -16,7 +16,7 @@ RUN apt-get update && apt-get install -y software-properties-common python-softw php7.2 php-cli php-fpm php-curl php-pear php-mcrypt php-zip php-mbstring php-xml \ php-pgsql php-redis \ \ - && apt-cache pkgnames | grep php7.1 \ + && apt-cache pkgnames | grep php7.2 \ && apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* \ && php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" \ && php composer-setup.php --install-dir=/usr/local/bin --filename=composer diff --git a/dockerfiles/tasks/composer/build.sh b/dockerfiles/tasks/composer/build.sh index 2b4e6d5..7b7e7f4 100644 --- a/dockerfiles/tasks/composer/build.sh +++ b/dockerfiles/tasks/composer/build.sh @@ -2,5 +2,13 @@ docker build --rm -t xaicorp/composer:7.0 . +docker run --rm --entrypoint php xaicorp/composer:7.0 --version | grep 'PHP 7.0.' +docker run --rm xaicorp/composer:7.0 --version | grep 'Composer' + docker build --rm -f Dockerfile-71 -t xaicorp/composer:7.1 . +docker run --rm --entrypoint php xaicorp/composer:7.1 --version | grep 'PHP 7.1.' +docker run --rm xaicorp/composer:7.1 --version | grep 'Composer' + docker build --rm -f Dockerfile-72 -t xaicorp/composer:7.2 . +docker run --rm --entrypoint php xaicorp/composer:7.2 --version | grep 'PHP 7.2.' +docker run --rm xaicorp/composer:7.2 --version | grep 'Composer' diff --git a/dockerfiles/tasks/dev-php7.0/Dockerfile-70 b/dockerfiles/tasks/dev-php7.0/Dockerfile-70 index 6cf1827..7466c59 100644 --- a/dockerfiles/tasks/dev-php7.0/Dockerfile-70 +++ b/dockerfiles/tasks/dev-php7.0/Dockerfile-70 @@ -20,4 +20,4 @@ RUN apt-get update && apt-get install -y \ COPY ./docker-php-fpm.conf /etc/php/7.0/fpm/pool.d/www.conf -ENTRYPOINT ["/usr/sbin/php-fpm7.0", "-F"] +CMD ["/usr/sbin/php-fpm7.0", "-F"] diff --git a/dockerfiles/tasks/dev-php7.0/Dockerfile-71 b/dockerfiles/tasks/dev-php7.0/Dockerfile-71 index fa3934b..7b1ba41 100644 --- a/dockerfiles/tasks/dev-php7.0/Dockerfile-71 +++ b/dockerfiles/tasks/dev-php7.0/Dockerfile-71 @@ -15,13 +15,13 @@ RUN apt-get update && apt-get install -y software-properties-common python-softw && LC_ALL=C.UTF-8 add-apt-repository -y ppa:ondrej/php \ && apt-get update && apt-get install -y \ curl nano sed libwww-perl htop ca-certificates \ - php7.1 php-cli php-fpm php-curl php-pear php-mcrypt php-zip php-mbstring php-xml \ + php7.1 php7.1-cli php7.1-fpm php-curl php-pear php-mcrypt php-zip php-mbstring php-xml \ php-pgsql php-redis \ \ && apt-cache pkgnames | grep php7.1 \ + && rm /usr/bin/php && ln -s /usr/bin/php7.1 /usr/bin/php \ && apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* - COPY ./docker-php-fpm.conf /etc/php/7.1fpm/pool.d/www.conf -ENTRYPOINT ["/usr/sbin/php-fpm7.1", "-F"] +CMD ["/usr/sbin/php-fpm7.1", "-F"] diff --git a/dockerfiles/tasks/dev-php7.0/Dockerfile-72 b/dockerfiles/tasks/dev-php7.0/Dockerfile-72 new file mode 100644 index 0000000..103626c --- /dev/null +++ b/dockerfiles/tasks/dev-php7.0/Dockerfile-72 @@ -0,0 +1,27 @@ +# Create a base Ubuntu image to build upon +# docker build --rm -f Dockerfile-71 -t composer:7.1 . +FROM ubuntu:16.04 +MAINTAINER Richard Morgan + +WORKDIR /opt/project + +EXPOSE 9000 + +# set terminal variable so that tools such as nano and htop work +# this is not needed in prod containers, but is useful for devs +ENV TERM=xterm + +RUN apt-get update && apt-get install -y software-properties-common python-software-properties \ + && LC_ALL=C.UTF-8 add-apt-repository -y ppa:ondrej/php \ + && apt-get update && apt-get install -y \ + curl nano sed libwww-perl htop ca-certificates \ + php7.2 php7.2-cli php7.2-fpm php-curl php-pear php-mcrypt php-zip php-mbstring php-xml \ + php-pgsql php-redis \ + \ + && apt-cache pkgnames | grep php7.2 \ + && rm /usr/bin/php && ln -s /usr/bin/php7.2 /usr/bin/php \ + && apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* + +COPY ./docker-php-fpm.conf /etc/php/7.2fpm/pool.d/www.conf + +CMD ["/usr/sbin/php-fpm7.2", "-F"] diff --git a/dockerfiles/tasks/dev-php7.0/Dockerfile-72-dev b/dockerfiles/tasks/dev-php7.0/Dockerfile-72-dev new file mode 100755 index 0000000..531cfa8 --- /dev/null +++ b/dockerfiles/tasks/dev-php7.0/Dockerfile-72-dev @@ -0,0 +1,13 @@ +# Create a base Ubuntu image to build upon +FROM xaicorp/php:7.2 +MAINTAINER Richard Morgan + +RUN apt-get update && apt-get install -y \ + php-xdebug \ + && apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* \ + && echo "xdebug.remote_enable=on" >> /etc/php/7.2/mods-available/xdebug.ini \ + && echo "xdebug.remote_autostart=on" >> /etc/php/7.2/mods-available/xdebug.ini \ + && echo "xdebug.remote_port = 9001" >> /etc/php/7.2/mods-available/xdebug.ini \ + && echo "xdebug.max_nesting_level=300" >> /etc/php/7.2/mods-available/xdebug.ini \ + && echo "xdebug.remote_connect_back=1" >> /etc/php/7.2/mods-available/xdebug.ini \ + && apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* diff --git a/dockerfiles/tasks/dev-php7.0/build.sh b/dockerfiles/tasks/dev-php7.0/build.sh index 0e16805..5ce5a61 100755 --- a/dockerfiles/tasks/dev-php7.0/build.sh +++ b/dockerfiles/tasks/dev-php7.0/build.sh @@ -2,6 +2,18 @@ docker build --rm -f Dockerfile-70 -t xaicorp/php:7.0 . docker build --rm -f Dockerfile-70-dev -t xaicorp/php:7.0-dev . +docker run --rm --entrypoint php xaicorp/php:7.0 --version | grep 'PHP 7.0.' +docker run --rm --entrypoint php xaicorp/php:7.0-dev --version | grep 'PHP 7.0.' +docker run --rm --entrypoint php xaicorp/php:7.0-dev --version | grep 'Xdebug' docker build --rm -f Dockerfile-71 -t xaicorp/php:7.1 . docker build --rm -f Dockerfile-71-dev -t xaicorp/php:7.1-dev . +docker run --rm --entrypoint php xaicorp/php:7.1 --version | grep 'PHP 7.1.' +docker run --rm --entrypoint php xaicorp/php:7.1-dev --version | grep 'PHP 7.1.' +docker run --rm --entrypoint php xaicorp/php:7.1-dev --version | grep 'Xdebug' + +docker build --rm -f Dockerfile-72 -t xaicorp/php:7.2 . +docker build --rm -f Dockerfile-72-dev -t xaicorp/php:7.2-dev . +docker run --rm --entrypoint php xaicorp/php:7.2 --version | grep 'PHP 7.2.' +docker run --rm --entrypoint php xaicorp/php:7.2-dev --version | grep 'PHP 7.2.' +docker run --rm --entrypoint php xaicorp/php:7.2-dev --version | grep 'Xdebug'