Skip to content

Commit

Permalink
Add README that references instructions for building containers on di…
Browse files Browse the repository at this point in the history
…fferent versions of PHP, and add a couple of new php versions.
  • Loading branch information
michaelmcandrew committed Mar 8, 2018
1 parent 29c9a25 commit 42e1244
Show file tree
Hide file tree
Showing 18 changed files with 358 additions and 1 deletion.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ You can then:

**Note**: the above aliases assume you have downloaded this repo to `$HOME/civicrm-buildkit-docker`. Please adjust as appropriate if you have downloaded it somewhere else.

### Using different versions of PHP

See [publish/README.md](publish/README.md) for instructions on how to build CiviCRM containers that use different versions of PHP.

## Getting help

Expand Down
105 changes: 105 additions & 0 deletions publish/civicrm/php7.1/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
FROM php:7.1-apache-jessie

# Install apt packages
#
# Required for php extensions
# * gd: libpng-dev
# * imagick: libmagickwand-dev
# * imap: libc-client-dev, libkrb5-dev
# * intl: libicu-dev
# * mcrypt: libmcrypt-dev
# * soap: libxml2-dev
# * zip: zlib1g-dev
#
# Used in the build process
# * git
# * mysql-client
# * sudo
# * unzip
# * zip
# * node 9.x (from nodesource repository)
RUN curl -sL https://deb.nodesource.com/setup_9.x | bash \
&& apt-get update \
&& apt-get install -y --no-install-recommends \
git \
libc-client-dev \
libicu-dev \
libkrb5-dev \
libmagickwand-dev \
libmcrypt-dev \
libpng-dev \
libxml2-dev \
msmtp-mta \
mysql-client \
nodejs \
sudo \
unzip \
zip \
zlib1g-dev \
&& rm -r /var/lib/apt/lists/*

# Install php extensions (curl, json, mbstring, openssl, posix, phar
# are installed already and don't need to be specified here)
RUN docker-php-ext-install bcmath \
&& docker-php-ext-install gd \
&& docker-php-ext-install gettext \
&& docker-php-ext-configure imap --with-kerberos --with-imap-ssl \
&& docker-php-ext-install imap \
&& docker-php-ext-install intl \
&& docker-php-ext-install mcrypt \
&& docker-php-ext-install mysqli \
&& docker-php-ext-install pdo_mysql \
&& docker-php-ext-install soap \
&& docker-php-ext-install zip

RUN pecl install imagick \
&& pecl install xdebug

RUN a2enmod rewrite

RUN useradd --home-dir /buildkit --create-home buildkit

COPY sudo /etc/sudoers.d/buildkit

USER buildkit

WORKDIR /buildkit

ENV PATH="/buildkit/bin:${PATH}"

RUN git clone https://github.com/civicrm/civicrm-buildkit.git buildkit-tmp

RUN mv buildkit-tmp/* buildkit-tmp/.git* .

RUN rmdir buildkit-tmp

# Need to create this before we configure apache, otherwise it will complain
RUN mkdir -p .amp/apache.d

RUN mkdir -p .cache/bower

RUN mkdir .composer

RUN mkdir .drush

RUN mkdir .npm

RUN civi-download-tools

RUN civibuild cache-warmup

COPY --chown=buildkit:buildkit amp.services.yml /buildkit/.amp/services.yml

COPY buildkit.ini /usr/local/etc/php/conf.d/buildkit.ini

COPY msmtprc /etc/msmtprc

COPY apache.conf /etc/apache2/conf-enabled/buildkit.conf

RUN rm /buildkit/app/civicrm.settings.d/100-mail.php

COPY civibuild.conf /buildkit/app/civibuild.conf

COPY apache24-vhost.php /buildkit/build/.amp/apache24-vhost.php

USER root
12 changes: 12 additions & 0 deletions publish/civicrm/php7.1/amp.services.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
parameters:
version: 2
db_type: mysql_dsn
mysql_dsn: 'mysql://root:buildkit@mysql:3306'
perm_type: linuxAcl
perm_user: www-data
hosts_type: file
httpd_type: apache24
httpd_visibility: all
httpd_shared_ports: '8080'
httpd_restart_command: 'sudo /usr/sbin/apachectl graceful'
services: { }
3 changes: 3 additions & 0 deletions publish/civicrm/php7.1/apache.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
IncludeOptional /buildkit/.amp/apache.d/*.conf
ServerName localhost
Listen 8080
40 changes: 40 additions & 0 deletions publish/civicrm/php7.1/apache24-vhost.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?php
/* Apache Virtual Host Template
*
* @var string $root - the local path to the web root
* @var string $host - the hostname to listen for
* @var int $port - the port to listen for
* @var string $include_vhost_file - the local path to a related config file
* @var string $visibility - which interfaces the vhost is available on
*/

?>

<?php if ($use_listen) { ?>
<?php if ($visibility === 'all'): ?>
Listen <?php echo $port ?>
<?php else: ?>
Listen 127.0.0.1:<?php echo $port ?>
<?php endif; ?>
<?php } ?>

<VirtualHost *:<?php echo $port ?>>
ServerAdmin webmaster@<?php echo $host ?>

DocumentRoot "<?php echo $root ?>"

ServerName <?php echo $host ?>

<Directory "<?php echo $root ?>">
Options All
AllowOverride All
<IfModule mod_authz_host.c>
Require <?php echo $visibility ?> granted
</IfModule>
</Directory>

<?php if (!empty($include_vhost_file)) { ?>
Include <?php echo $include_vhost_file ?>
<?php } ?>

</VirtualHost>
6 changes: 6 additions & 0 deletions publish/civicrm/php7.1/buildkit.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
memory_limit = 1024M
cgi.fix_pathinfo = Off
sendmail_path=/usr/sbin/sendmail -t -i

zend_extension=xdebug.so
xdebug.show_error_trace = On
7 changes: 7 additions & 0 deletions publish/civicrm/php7.1/civibuild.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

# See https://github.com/civicrm/civicrm-buildkit/blob/master/app/civibuild.conf.tmpl

# Using the buildkit suffix rather than chrome's dev suffix because of
# https://www.theregister.co.uk/2017/11/29/google_dev_network/
URL_TEMPLATE="http://%SITE_NAME%.buildkit:8080"
3 changes: 3 additions & 0 deletions publish/civicrm/php7.1/msmtprc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
host maildev
auto_from on
maildomain buildkit
1 change: 1 addition & 0 deletions publish/civicrm/php7.1/sudo
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
buildkit ALL=(ALL) NOPASSWD:ALL
105 changes: 105 additions & 0 deletions publish/civicrm/php7.2/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
FROM php:7.2-apache-jessie

# Install apt packages
#
# Required for php extensions
# * gd: libpng-dev
# * imagick: libmagickwand-dev
# * imap: libc-client-dev, libkrb5-dev
# * intl: libicu-dev
# * mcrypt: libmcrypt-dev
# * soap: libxml2-dev
# * zip: zlib1g-dev
#
# Used in the build process
# * git
# * mysql-client
# * sudo
# * unzip
# * zip
# * node 9.x (from nodesource repository)
RUN curl -sL https://deb.nodesource.com/setup_9.x | bash \
&& apt-get update \
&& apt-get install -y --no-install-recommends \
git \
libc-client-dev \
libicu-dev \
libkrb5-dev \
libmagickwand-dev \
libmcrypt-dev \
libpng-dev \
libxml2-dev \
msmtp-mta \
mysql-client \
nodejs \
sudo \
unzip \
zip \
zlib1g-dev \
&& rm -r /var/lib/apt/lists/*

# Install php extensions (curl, json, mbstring, openssl, posix, phar
# are installed already and don't need to be specified here)
RUN docker-php-ext-install bcmath \
&& docker-php-ext-install gd \
&& docker-php-ext-install gettext \
&& docker-php-ext-configure imap --with-kerberos --with-imap-ssl \
&& docker-php-ext-install imap \
&& docker-php-ext-install intl \
&& docker-php-ext-install mcrypt \
&& docker-php-ext-install mysqli \
&& docker-php-ext-install pdo_mysql \
&& docker-php-ext-install soap \
&& docker-php-ext-install zip

RUN pecl install imagick \
&& pecl install xdebug

RUN a2enmod rewrite

RUN useradd --home-dir /buildkit --create-home buildkit

COPY sudo /etc/sudoers.d/buildkit

USER buildkit

WORKDIR /buildkit

ENV PATH="/buildkit/bin:${PATH}"

RUN git clone https://github.com/civicrm/civicrm-buildkit.git buildkit-tmp

RUN mv buildkit-tmp/* buildkit-tmp/.git* .

RUN rmdir buildkit-tmp

# Need to create this before we configure apache, otherwise it will complain
RUN mkdir -p .amp/apache.d

RUN mkdir -p .cache/bower

RUN mkdir .composer

RUN mkdir .drush

RUN mkdir .npm

RUN civi-download-tools

RUN civibuild cache-warmup

COPY --chown=buildkit:buildkit amp.services.yml /buildkit/.amp/services.yml

COPY buildkit.ini /usr/local/etc/php/conf.d/buildkit.ini

COPY msmtprc /etc/msmtprc

COPY apache.conf /etc/apache2/conf-enabled/buildkit.conf

RUN rm /buildkit/app/civicrm.settings.d/100-mail.php

COPY civibuild.conf /buildkit/app/civibuild.conf

COPY apache24-vhost.php /buildkit/build/.amp/apache24-vhost.php

USER root
12 changes: 12 additions & 0 deletions publish/civicrm/php7.2/amp.services.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
parameters:
version: 2
db_type: mysql_dsn
mysql_dsn: 'mysql://root:buildkit@mysql:3306'
perm_type: linuxAcl
perm_user: www-data
hosts_type: file
httpd_type: apache24
httpd_visibility: all
httpd_shared_ports: '8080'
httpd_restart_command: 'sudo /usr/sbin/apachectl graceful'
services: { }
3 changes: 3 additions & 0 deletions publish/civicrm/php7.2/apache.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
IncludeOptional /buildkit/.amp/apache.d/*.conf
ServerName localhost
Listen 8080
40 changes: 40 additions & 0 deletions publish/civicrm/php7.2/apache24-vhost.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?php
/* Apache Virtual Host Template
*
* @var string $root - the local path to the web root
* @var string $host - the hostname to listen for
* @var int $port - the port to listen for
* @var string $include_vhost_file - the local path to a related config file
* @var string $visibility - which interfaces the vhost is available on
*/

?>

<?php if ($use_listen) { ?>
<?php if ($visibility === 'all'): ?>
Listen <?php echo $port ?>
<?php else: ?>
Listen 127.0.0.1:<?php echo $port ?>
<?php endif; ?>
<?php } ?>

<VirtualHost *:<?php echo $port ?>>
ServerAdmin webmaster@<?php echo $host ?>

DocumentRoot "<?php echo $root ?>"

ServerName <?php echo $host ?>

<Directory "<?php echo $root ?>">
Options All
AllowOverride All
<IfModule mod_authz_host.c>
Require <?php echo $visibility ?> granted
</IfModule>
</Directory>

<?php if (!empty($include_vhost_file)) { ?>
Include <?php echo $include_vhost_file ?>
<?php } ?>

</VirtualHost>
6 changes: 6 additions & 0 deletions publish/civicrm/php7.2/buildkit.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
memory_limit = 1024M
cgi.fix_pathinfo = Off
sendmail_path=/usr/sbin/sendmail -t -i

zend_extension=xdebug.so
xdebug.show_error_trace = On
7 changes: 7 additions & 0 deletions publish/civicrm/php7.2/civibuild.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

# See https://github.com/civicrm/civicrm-buildkit/blob/master/app/civibuild.conf.tmpl

# Using the buildkit suffix rather than chrome's dev suffix because of
# https://www.theregister.co.uk/2017/11/29/google_dev_network/
URL_TEMPLATE="http://%SITE_NAME%.buildkit:8080"
3 changes: 3 additions & 0 deletions publish/civicrm/php7.2/msmtprc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
host maildev
auto_from on
maildomain buildkit
1 change: 1 addition & 0 deletions publish/civicrm/php7.2/sudo
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
buildkit ALL=(ALL) NOPASSWD:ALL
2 changes: 1 addition & 1 deletion publish/publish.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
$twig = new Twig_Environment($loader, array(
));

$phpVersions = ['5.6', '7.0'];
$phpVersions = ['5.6', '7.0', '7.1', '7.2'];

foreach($phpVersions as $phpVersion){
$dir = __DIR__. "/civicrm/php{$phpVersion}";
Expand Down

0 comments on commit 42e1244

Please sign in to comment.