Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add PHP 7.2 CLI image #62

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ env:
- VERSION=php/7.0/fpm/
- VERSION=php/7.1/
- VERSION=php/7.1/fpm/
- VERSION=php/7.2

before_script:
- cd $VERSION
Expand Down
151 changes: 151 additions & 0 deletions php/7.2/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
FROM php:7.2

ENV XDEBUG_VERSION 2.6.0

RUN additionalPackages=" \
apt-transport-https \
git \
msmtp-mta \
openssh-client \
rsync \
" \
buildDeps=" \
freetds-dev \
libbz2-dev \
libc-client-dev \
libenchant-dev \
libfreetype6-dev \
libgmp3-dev \
libicu-dev \
libjpeg62-turbo-dev \
libkrb5-dev \
libldap2-dev \
libmcrypt-dev \
libpng-dev \
libpq-dev \
libpspell-dev \
librabbitmq-dev \
libsasl2-dev \
libsnmp-dev \
libssl-dev \
libtidy-dev \
libxml2-dev \
libxpm-dev \
libxslt1-dev \
zlib1g-dev \
" \
&& runDeps=" \
gnupg2 \
libc-client2007e \
libenchant1c2a \
libfreetype6 \
libicu57 \
libjpeg62-turbo \
libmcrypt4 \
libpng16-16 \
libpq5 \
libsybdb5 \
libtidy5 \
libx11-6 \
libxpm4 \
libxslt1.1 \
snmp \
" \
&& phpModules=" \
bcmath \
bz2 \
calendar \
dba \
enchant \
exif \
ftp \
gd \
gettext \
gmp \
imap \
intl \
ldap \
mbstring \
mysqli \
opcache \
pcntl \
pdo \
pdo_dblib \
pdo_mysql \
pdo_pgsql \
pgsql \
pspell \
shmop \
snmp \
soap \
sockets \
sysvmsg \
sysvsem \
sysvshm \
tidy \
wddx \
xmlrpc \
xsl \
zip \
xdebug \
" \
&& echo "deb http://httpredir.debian.org/debian jessie contrib non-free" > /etc/apt/sources.list.d/additional.list \
&& apt-get update \
&& apt-get install -y --no-install-recommends $additionalPackages $buildDeps $runDeps \
&& docker-php-source extract \
&& cd /usr/src/php/ext/ \
&& curl -L http://xdebug.org/files/xdebug-$XDEBUG_VERSION.tgz | tar -zxf - \
&& mv xdebug-$XDEBUG_VERSION xdebug \
&& ln -s /usr/include/x86_64-linux-gnu/gmp.h /usr/include/gmp.h \
&& ln -s /usr/lib/x86_64-linux-gnu/libldap_r.so /usr/lib/libldap.so \
&& ln -s /usr/lib/x86_64-linux-gnu/libldap_r.a /usr/lib/libldap_r.a \
&& ln -s /usr/lib/x86_64-linux-gnu/libsybdb.a /usr/lib/libsybdb.a \
&& ln -s /usr/lib/x86_64-linux-gnu/libsybdb.so /usr/lib/libsybdb.so \
&& docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ --with-xpm-dir=/usr/include/ \
&& docker-php-ext-configure imap --with-imap --with-kerberos --with-imap-ssl \
&& docker-php-ext-configure ldap --with-ldap-sasl \
&& docker-php-ext-install $phpModules \
&& printf "\n" | pecl install amqp \
&& pecl install igbinary \
# && printf "\n" | pecl install memcache \
&& pecl install mongodb \
&& pecl install redis \
&& for ext in $phpModules; do \
rm -f /usr/local/etc/php/conf.d/docker-php-ext-$ext.ini; \
done \
&& docker-php-source delete \
&& apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false -o APT::AutoRemove::SuggestsImportant=false $buildDeps \
&& apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

# Install composer and put binary into $PATH
RUN curl -sS https://getcomposer.org/installer | php \
&& mv composer.phar /usr/local/bin/ \
&& ln -s /usr/local/bin/composer.phar /usr/local/bin/composer

# Install phpunit and put binary into $PATH
RUN curl -sSLo phpunit.phar https://phar.phpunit.de/phpunit.phar \
&& chmod 755 phpunit.phar \
&& mv phpunit.phar /usr/local/bin/ \
&& ln -s /usr/local/bin/phpunit.phar /usr/local/bin/phpunit

# Install PHP Code sniffer
RUN curl -OL https://squizlabs.github.io/PHP_CodeSniffer/phpcs.phar \
&& chmod 755 phpcs.phar \
&& mv phpcs.phar /usr/local/bin/ \
&& ln -s /usr/local/bin/phpcs.phar /usr/local/bin/phpcs \
&& curl -OL https://squizlabs.github.io/PHP_CodeSniffer/phpcbf.phar \
&& chmod 755 phpcbf.phar \
&& mv phpcbf.phar /usr/local/bin/ \
&& ln -s /usr/local/bin/phpcbf.phar /usr/local/bin/phpcbf

# Install Node.js & Yarn
RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - \
&& echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list \
&& curl -sL https://deb.nodesource.com/setup_8.x | bash - \
&& apt-get install -y nodejs build-essential yarn \
&& apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

COPY msmtprc /etc/
COPY entrypoint.sh /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
CMD ["php", "-a"]
32 changes: 32 additions & 0 deletions php/7.2/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/bin/bash
set -e

# With env variable WITH_XDEBUG=1 xdebug extension will be enabled
[ ! -z "$WITH_XDEBUG" ] && docker-php-ext-enable xdebug

# Provide github token if you are using composer a lot in non-interactive mode
# Otherwise one day it will get stuck with request for authorization
# https://github.com/settings/tokens
if [[ ! -z "$COMPOSER_GITHUB" ]]
then
composer config --global github-oauth.github.com "$COMPOSER_GITHUB"
fi

#
# If $TIMEZONE variable is passed to the image - it will set system timezone
# and php.ini date.timezone value as well
# Overwise the default system Etc/UTC timezone will be used
#
# Also you can set the php timezone with direct setting it in php.ini
# within your .gitlab-ci.yml like
# before_script:
# - echo "America/New_York" > /usr/local/etc/php/conf.d/timezone.ini

if [[ ! -z "$TIMEZONE" ]]
then
echo "$TIMEZONE" > /etc/timezone
dpkg-reconfigure -f noninteractive tzdata
fi
echo "date.timezone=`cat /etc/timezone`" > /usr/local/etc/php/conf.d/timezone.ini

exec "$@"
18 changes: 18 additions & 0 deletions php/7.2/msmtprc
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# A system wide configuration is optional.
# If it exists, it usually defines a default account.
# This allows msmtp to be used like /usr/sbin/sendmail.
account default

# The SMTP smarthost.
host localhost

# Construct envelope-from addresses of the form "[email protected]".
#auto_from on
#maildomain oursite.example

# Use TLS.
#tls on
#tls_trust_file /etc/ssl/certs/ca-certificates.crt

# Syslog logging with facility LOG_MAIL instead of the default LOG_USER.
#syslog LOG_MAIL