From 8bb529b88df65a00efa3285d376a6ae6305c424b Mon Sep 17 00:00:00 2001 From: Meritoo Date: Sat, 2 Dec 2017 13:23:26 +0100 Subject: [PATCH] Docker - Dockerfile - minor refactoring --- .docker/config/Dockerfile | 65 +++++++++++++++++++++++++++++---------- 1 file changed, 49 insertions(+), 16 deletions(-) diff --git a/.docker/config/Dockerfile b/.docker/config/Dockerfile index 222acc8..db62e09 100644 --- a/.docker/config/Dockerfile +++ b/.docker/config/Dockerfile @@ -1,4 +1,5 @@ FROM php:5.5-cli +MAINTAINER Meritoo # # Tools & libraries @@ -10,7 +11,10 @@ RUN apt-get update \ unzip \ libicu-dev \ && apt-get clean \ - && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* + && rm -rf \ + /var/lib/apt/lists/* \ + /tmp/* \ + /var/tmp/* # # PHP extensions @@ -19,6 +23,17 @@ RUN docker-php-ext-install \ intl \ 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: # - default configuration @@ -26,14 +41,11 @@ RUN docker-php-ext-install \ # COPY php.ini /usr/local/etc/php/php.ini ARG TIMEZONE -RUN echo "\n""date.timezone = $TIMEZONE""\n" >> /usr/local/etc/php/php.ini - -# -# Xdebug -# -RUN pecl install xdebug \ - && docker-php-ext-enable xdebug -COPY xdebug.ini /usr/local/etc/php/conf.d/docker-php-ext-xdebug.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 \ + && "date" +#RUN echo "\n""date.timezone = $TIMEZONE""\n" >> /usr/local/etc/php/php.ini # # 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 \ && 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 # RUN php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" \ && php -r "if (hash_file('SHA384', 'composer-setup.php') === \ - '544e09ee996cdf60ece3804abc52599c22b1f40f4323403c44d44fdfdd586475ca9813a858088ffbc1f233e9b180f061') { echo \ - 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;" \ + '544e09ee996cdf60ece3804abc52599c22b1f40f4323403c44d44fdfdd586475ca9813a858088ffbc1f233e9b180f061') { echo \ + '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 -r "unlink('composer-setup.php');" \ - && composer global require --no-plugins --no-scripts hirak/prestissimo \ - && rm -rf /root/.composer/cache/* + && composer global require \ + --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 # -RUN sed -i 's/^# export/export/g' /root/.bashrc \ - && sed -i 's/^# alias/alias/g' /root/.bashrc \ - && echo "\n"'export PATH=/project/vendor/bin:$PATH'"\n" >> /root/.bashrc +RUN sed -i 's/^# export/export/g' ~/.bashrc \ + && sed -i 's/^# alias/alias/g' ~/.bashrc \ + && echo "\n"'export PATH=/project/vendor/bin:$PATH'"\n" >> ~/.bashrc