Skip to content

Commit

Permalink
calculate host ip using entrypoint
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelmcandrew committed Nov 21, 2018
1 parent 4d6a617 commit eb6e09e
Show file tree
Hide file tree
Showing 19 changed files with 119 additions and 8 deletions.
12 changes: 11 additions & 1 deletion civicrm/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM php:7.0-apache-jessie
FROM php:7.1-apache-jessie

# Install apt packages
#
Expand All @@ -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 \
Expand Down Expand Up @@ -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"]
1 change: 0 additions & 1 deletion civicrm/buildkit.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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
12 changes: 12 additions & 0 deletions civicrm/docker-civicrm-entrypoint
Original file line number Diff line number Diff line change
@@ -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 "$@"
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ version: '3.4'
services:

civicrm:
image: michaelmcandrew/civicrm
image: michaelmcandrew/civicrm-buildkit
hostname: civicrm
environment:
TERM: xterm-color
Expand Down
6 changes: 6 additions & 0 deletions publish/civicrm/php5.6/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
1 change: 0 additions & 1 deletion publish/civicrm/php5.6/buildkit.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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
12 changes: 12 additions & 0 deletions publish/civicrm/php5.6/docker-civicrm-entrypoint
Original file line number Diff line number Diff line change
@@ -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 "$@"
6 changes: 6 additions & 0 deletions publish/civicrm/php7.0/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
1 change: 0 additions & 1 deletion publish/civicrm/php7.0/buildkit.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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
12 changes: 12 additions & 0 deletions publish/civicrm/php7.0/docker-civicrm-entrypoint
Original file line number Diff line number Diff line change
@@ -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 "$@"
6 changes: 6 additions & 0 deletions publish/civicrm/php7.1/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
1 change: 0 additions & 1 deletion publish/civicrm/php7.1/buildkit.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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
12 changes: 12 additions & 0 deletions publish/civicrm/php7.1/docker-civicrm-entrypoint
Original file line number Diff line number Diff line change
@@ -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 "$@"
6 changes: 6 additions & 0 deletions publish/civicrm/php7.2/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
1 change: 0 additions & 1 deletion publish/civicrm/php7.2/buildkit.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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
12 changes: 12 additions & 0 deletions publish/civicrm/php7.2/docker-civicrm-entrypoint
Original file line number Diff line number Diff line change
@@ -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 "$@"
11 changes: 11 additions & 0 deletions publish/templates/civicrm/Dockerfile.twig
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down Expand Up @@ -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"]
1 change: 0 additions & 1 deletion publish/templates/civicrm/buildkit.ini.twig
Original file line number Diff line number Diff line change
Expand Up @@ -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
12 changes: 12 additions & 0 deletions publish/templates/civicrm/docker-civicrm-entrypoint.twig
Original file line number Diff line number Diff line change
@@ -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 "$@"

0 comments on commit eb6e09e

Please sign in to comment.