diff --git a/civicrm/Dockerfile b/civicrm/Dockerfile index 5b22a1d..54021ee 100644 --- a/civicrm/Dockerfile +++ b/civicrm/Dockerfile @@ -1,4 +1,4 @@ -FROM php:7.0-apache-jessie +FROM php:7.1-apache-jessie # Install apt packages # @@ -18,10 +18,14 @@ FROM php:7.0-apache-jessie # * unzip # * zip # * node 9.x (from nodesource repository) +# +# iproute2 is required to get host ip from container + RUN curl -sL https://deb.nodesource.com/setup_9.x | bash \ && apt-get update \ && apt-get install -y --no-install-recommends \ git \ + iproute2 \ libc-client-dev \ libicu-dev \ libkrb5-dev \ @@ -111,3 +115,9 @@ COPY civibuild.conf /buildkit/app/civibuild.conf COPY apache24-vhost.php /buildkit/build/.amp/apache24-vhost.php USER root + +COPY ./docker-civicrm-entrypoint /usr/local/bin + +ENTRYPOINT [ "docker-civicrm-entrypoint" ] + +CMD ["apache2-foreground"] diff --git a/civicrm/buildkit.ini b/civicrm/buildkit.ini index 2ee9b43..1a73134 100644 --- a/civicrm/buildkit.ini +++ b/civicrm/buildkit.ini @@ -6,4 +6,3 @@ zend_extension=xdebug.so xdebug.show_error_trace = On xdebug.remote_enable = On xdebug.remote_autostart = 1 -xdebug.remote_host = 172.26.0.1 diff --git a/civicrm/docker-civicrm-entrypoint b/civicrm/docker-civicrm-entrypoint new file mode 100755 index 0000000..9766da0 --- /dev/null +++ b/civicrm/docker-civicrm-entrypoint @@ -0,0 +1,12 @@ +#!/bin/sh +set -e + +# Set remote host for xdebug +export XDEBUG_REMOTE_HOST=`/sbin/ip route|awk '/default/ { print $3 }'` + +# first arg is `-f` or `--some-option` +if [ "${1#-}" != "$1" ]; then + set -- apache2-foreground "$@" +fi + +exec "$@" diff --git a/docker-compose.yml b/docker-compose.yml index 5dd6d8b..d37f6f9 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -3,7 +3,7 @@ version: '3.4' services: civicrm: - image: michaelmcandrew/civicrm + image: michaelmcandrew/civicrm-buildkit hostname: civicrm environment: TERM: xterm-color diff --git a/publish/civicrm/php5.6/Dockerfile b/publish/civicrm/php5.6/Dockerfile index 0eaa0c9..15055b2 100644 --- a/publish/civicrm/php5.6/Dockerfile +++ b/publish/civicrm/php5.6/Dockerfile @@ -111,3 +111,9 @@ COPY civibuild.conf /buildkit/app/civibuild.conf COPY apache24-vhost.php /buildkit/build/.amp/apache24-vhost.php USER root + +COPY ./docker-civicrm-entrypoint /usr/local/bin + +ENTRYPOINT [ "docker-civicrm-entrypoint" ] + +CMD ["apache2-foreground"] diff --git a/publish/civicrm/php5.6/buildkit.ini b/publish/civicrm/php5.6/buildkit.ini index 2ee9b43..1a73134 100644 --- a/publish/civicrm/php5.6/buildkit.ini +++ b/publish/civicrm/php5.6/buildkit.ini @@ -6,4 +6,3 @@ zend_extension=xdebug.so xdebug.show_error_trace = On xdebug.remote_enable = On xdebug.remote_autostart = 1 -xdebug.remote_host = 172.26.0.1 diff --git a/publish/civicrm/php5.6/docker-civicrm-entrypoint b/publish/civicrm/php5.6/docker-civicrm-entrypoint new file mode 100644 index 0000000..9766da0 --- /dev/null +++ b/publish/civicrm/php5.6/docker-civicrm-entrypoint @@ -0,0 +1,12 @@ +#!/bin/sh +set -e + +# Set remote host for xdebug +export XDEBUG_REMOTE_HOST=`/sbin/ip route|awk '/default/ { print $3 }'` + +# first arg is `-f` or `--some-option` +if [ "${1#-}" != "$1" ]; then + set -- apache2-foreground "$@" +fi + +exec "$@" diff --git a/publish/civicrm/php7.0/Dockerfile b/publish/civicrm/php7.0/Dockerfile index 5b22a1d..707ec21 100644 --- a/publish/civicrm/php7.0/Dockerfile +++ b/publish/civicrm/php7.0/Dockerfile @@ -111,3 +111,9 @@ COPY civibuild.conf /buildkit/app/civibuild.conf COPY apache24-vhost.php /buildkit/build/.amp/apache24-vhost.php USER root + +COPY ./docker-civicrm-entrypoint /usr/local/bin + +ENTRYPOINT [ "docker-civicrm-entrypoint" ] + +CMD ["apache2-foreground"] diff --git a/publish/civicrm/php7.0/buildkit.ini b/publish/civicrm/php7.0/buildkit.ini index 2ee9b43..1a73134 100644 --- a/publish/civicrm/php7.0/buildkit.ini +++ b/publish/civicrm/php7.0/buildkit.ini @@ -6,4 +6,3 @@ zend_extension=xdebug.so xdebug.show_error_trace = On xdebug.remote_enable = On xdebug.remote_autostart = 1 -xdebug.remote_host = 172.26.0.1 diff --git a/publish/civicrm/php7.0/docker-civicrm-entrypoint b/publish/civicrm/php7.0/docker-civicrm-entrypoint new file mode 100644 index 0000000..9766da0 --- /dev/null +++ b/publish/civicrm/php7.0/docker-civicrm-entrypoint @@ -0,0 +1,12 @@ +#!/bin/sh +set -e + +# Set remote host for xdebug +export XDEBUG_REMOTE_HOST=`/sbin/ip route|awk '/default/ { print $3 }'` + +# first arg is `-f` or `--some-option` +if [ "${1#-}" != "$1" ]; then + set -- apache2-foreground "$@" +fi + +exec "$@" diff --git a/publish/civicrm/php7.1/Dockerfile b/publish/civicrm/php7.1/Dockerfile index b11f04d..ee9867f 100644 --- a/publish/civicrm/php7.1/Dockerfile +++ b/publish/civicrm/php7.1/Dockerfile @@ -111,3 +111,9 @@ COPY civibuild.conf /buildkit/app/civibuild.conf COPY apache24-vhost.php /buildkit/build/.amp/apache24-vhost.php USER root + +COPY ./docker-civicrm-entrypoint /usr/local/bin + +ENTRYPOINT [ "docker-civicrm-entrypoint" ] + +CMD ["apache2-foreground"] diff --git a/publish/civicrm/php7.1/buildkit.ini b/publish/civicrm/php7.1/buildkit.ini index 2ee9b43..1a73134 100644 --- a/publish/civicrm/php7.1/buildkit.ini +++ b/publish/civicrm/php7.1/buildkit.ini @@ -6,4 +6,3 @@ zend_extension=xdebug.so xdebug.show_error_trace = On xdebug.remote_enable = On xdebug.remote_autostart = 1 -xdebug.remote_host = 172.26.0.1 diff --git a/publish/civicrm/php7.1/docker-civicrm-entrypoint b/publish/civicrm/php7.1/docker-civicrm-entrypoint new file mode 100644 index 0000000..9766da0 --- /dev/null +++ b/publish/civicrm/php7.1/docker-civicrm-entrypoint @@ -0,0 +1,12 @@ +#!/bin/sh +set -e + +# Set remote host for xdebug +export XDEBUG_REMOTE_HOST=`/sbin/ip route|awk '/default/ { print $3 }'` + +# first arg is `-f` or `--some-option` +if [ "${1#-}" != "$1" ]; then + set -- apache2-foreground "$@" +fi + +exec "$@" diff --git a/publish/civicrm/php7.2/Dockerfile b/publish/civicrm/php7.2/Dockerfile index 3e85457..3798c01 100644 --- a/publish/civicrm/php7.2/Dockerfile +++ b/publish/civicrm/php7.2/Dockerfile @@ -111,3 +111,9 @@ COPY civibuild.conf /buildkit/app/civibuild.conf COPY apache24-vhost.php /buildkit/build/.amp/apache24-vhost.php USER root + +COPY ./docker-civicrm-entrypoint /usr/local/bin + +ENTRYPOINT [ "docker-civicrm-entrypoint" ] + +CMD ["apache2-foreground"] diff --git a/publish/civicrm/php7.2/buildkit.ini b/publish/civicrm/php7.2/buildkit.ini index 2ee9b43..1a73134 100644 --- a/publish/civicrm/php7.2/buildkit.ini +++ b/publish/civicrm/php7.2/buildkit.ini @@ -6,4 +6,3 @@ zend_extension=xdebug.so xdebug.show_error_trace = On xdebug.remote_enable = On xdebug.remote_autostart = 1 -xdebug.remote_host = 172.26.0.1 diff --git a/publish/civicrm/php7.2/docker-civicrm-entrypoint b/publish/civicrm/php7.2/docker-civicrm-entrypoint new file mode 100644 index 0000000..9766da0 --- /dev/null +++ b/publish/civicrm/php7.2/docker-civicrm-entrypoint @@ -0,0 +1,12 @@ +#!/bin/sh +set -e + +# Set remote host for xdebug +export XDEBUG_REMOTE_HOST=`/sbin/ip route|awk '/default/ { print $3 }'` + +# first arg is `-f` or `--some-option` +if [ "${1#-}" != "$1" ]; then + set -- apache2-foreground "$@" +fi + +exec "$@" diff --git a/publish/templates/civicrm/Dockerfile.twig b/publish/templates/civicrm/Dockerfile.twig index af367e4..8b14c87 100644 --- a/publish/templates/civicrm/Dockerfile.twig +++ b/publish/templates/civicrm/Dockerfile.twig @@ -18,10 +18,15 @@ FROM php:{{ php_version }}-apache-jessie # * unzip # * zip # * node 9.x (from nodesource repository) +# +# iproute2 is required to get host ip from container + + RUN curl -sL https://deb.nodesource.com/setup_9.x | bash \ && apt-get update \ && apt-get install -y --no-install-recommends \ git \ + iproute2 \ libc-client-dev \ libicu-dev \ libkrb5-dev \ @@ -115,3 +120,9 @@ COPY civibuild.conf /buildkit/app/civibuild.conf COPY apache24-vhost.php /buildkit/build/.amp/apache24-vhost.php USER root + +COPY ./docker-civicrm-entrypoint /usr/local/bin + +ENTRYPOINT [ "docker-civicrm-entrypoint" ] + +CMD ["apache2-foreground"] diff --git a/publish/templates/civicrm/buildkit.ini.twig b/publish/templates/civicrm/buildkit.ini.twig index 2ee9b43..1a73134 100644 --- a/publish/templates/civicrm/buildkit.ini.twig +++ b/publish/templates/civicrm/buildkit.ini.twig @@ -6,4 +6,3 @@ zend_extension=xdebug.so xdebug.show_error_trace = On xdebug.remote_enable = On xdebug.remote_autostart = 1 -xdebug.remote_host = 172.26.0.1 diff --git a/publish/templates/civicrm/docker-civicrm-entrypoint.twig b/publish/templates/civicrm/docker-civicrm-entrypoint.twig new file mode 100755 index 0000000..9766da0 --- /dev/null +++ b/publish/templates/civicrm/docker-civicrm-entrypoint.twig @@ -0,0 +1,12 @@ +#!/bin/sh +set -e + +# Set remote host for xdebug +export XDEBUG_REMOTE_HOST=`/sbin/ip route|awk '/default/ { print $3 }'` + +# first arg is `-f` or `--some-option` +if [ "${1#-}" != "$1" ]; then + set -- apache2-foreground "$@" +fi + +exec "$@"