Docker - Dockerfile - minor refactoring

This commit is contained in:
Meritoo
2017-12-02 13:23:26 +01:00
parent 3588c00009
commit 8bb529b88d

View File

@@ -1,4 +1,5 @@
FROM php:5.5-cli FROM php:5.5-cli
MAINTAINER Meritoo <github@meritoo.pl>
# #
# Tools & libraries # Tools & libraries
@@ -10,7 +11,10 @@ RUN apt-get update \
unzip \ unzip \
libicu-dev \ libicu-dev \
&& apt-get clean \ && apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* && rm -rf \
/var/lib/apt/lists/* \
/tmp/* \
/var/tmp/*
# #
# PHP extensions # PHP extensions
@@ -19,6 +23,17 @@ RUN docker-php-ext-install \
intl \ intl \
mbstring mbstring
#
# PHP extensions (PECL):
# - Xdebug
#
RUN pecl install \
xdebug \
&& docker-php-ext-enable \
xdebug
COPY xdebug.ini /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini
# #
# PHP configuration: # PHP configuration:
# - default configuration # - default configuration
@@ -26,14 +41,11 @@ RUN docker-php-ext-install \
# #
COPY php.ini /usr/local/etc/php/php.ini COPY php.ini /usr/local/etc/php/php.ini
ARG TIMEZONE ARG TIMEZONE
RUN echo "\n""date.timezone = $TIMEZONE""\n" >> /usr/local/etc/php/php.ini RUN ln -snf /usr/share/zoneinfo/${TIMEZONE} /etc/localtime \
&& echo ${TIMEZONE} > /etc/timezone \
# && printf '[PHP]\ndate.timezone = "%s"\n', ${TIMEZONE} > /usr/local/etc/php/conf.d/tzone.ini \
# Xdebug && "date"
# #RUN echo "\n""date.timezone = $TIMEZONE""\n" >> /usr/local/etc/php/php.ini
RUN pecl install xdebug \
&& docker-php-ext-enable xdebug
COPY xdebug.ini /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini
# #
# Phing # Phing
@@ -41,21 +53,42 @@ COPY xdebug.ini /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini
RUN pear channel-discover pear.phing.info \ RUN pear channel-discover pear.phing.info \
&& pear install [--alldeps] phing/phing && pear install [--alldeps] phing/phing
#
# Composer - environment variables:
# - disable warning about running commands as root/super user
# - disable automatic clearing of sudo sessions
#
# More:
# https://getcomposer.org/doc/03-cli.md#composer-allow-superuser
#
ENV COMPOSER_ALLOW_SUPERUSER 1
# #
# Composer + https://packagist.org/packages/hirak/prestissimo package # Composer + https://packagist.org/packages/hirak/prestissimo package
# #
RUN php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" \ RUN php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" \
&& php -r "if (hash_file('SHA384', 'composer-setup.php') === \ && php -r "if (hash_file('SHA384', 'composer-setup.php') === \
'544e09ee996cdf60ece3804abc52599c22b1f40f4323403c44d44fdfdd586475ca9813a858088ffbc1f233e9b180f061') { echo \ '544e09ee996cdf60ece3804abc52599c22b1f40f4323403c44d44fdfdd586475ca9813a858088ffbc1f233e9b180f061') { echo \
'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;" \ 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;" \
&& php composer-setup.php --install-dir=/usr/local/bin --filename=composer \ && php composer-setup.php --install-dir=/usr/local/bin --filename=composer \
&& php -r "unlink('composer-setup.php');" \ && php -r "unlink('composer-setup.php');" \
&& composer global require --no-plugins --no-scripts hirak/prestissimo \ && composer global require \
&& rm -rf /root/.composer/cache/* --no-plugins \
--no-scripts \
--no-progress \
--no-suggest \
--no-interaction \
--prefer-dist \
--optimize-autoloader \
--classmap-authoritative \
hirak/prestissimo \
&& rm -rf ~/.composer/cache/* \
&& composer clear-cache \
&& composer --version
# #
# Bash # Bash
# #
RUN sed -i 's/^# export/export/g' /root/.bashrc \ RUN sed -i 's/^# export/export/g' ~/.bashrc \
&& sed -i 's/^# alias/alias/g' /root/.bashrc \ && sed -i 's/^# alias/alias/g' ~/.bashrc \
&& echo "\n"'export PATH=/project/vendor/bin:$PATH'"\n" >> /root/.bashrc && echo "\n"'export PATH=/project/vendor/bin:$PATH'"\n" >> ~/.bashrc