# This image is the base image for the Elastica development and includes all parts which rarely change
# PHP 5.4 Docker file with Composer installed
FROM php:5.4
MAINTAINER Nicolas Ruflin <spam@ruflin.com>

RUN apt-get update && apt-get install -y \
        cloc \
        git \
        graphviz \
        libxslt-dev \
        nano \
        php5-xsl \
        wget
        # XSL and Graphviz for PhpDocumentor

RUN docker-php-ext-install sockets xsl

RUN rm -r /var/lib/apt/lists/*

# Xdebug for coverage report
RUN pecl install xdebug-2.3.2

## PHP Configuration

RUN echo "memory_limit=2048M" >> /usr/local/etc/php/conf.d/memory-limit.ini
RUN echo "date.timezone=UTC" >> /usr/local/etc/php/conf.d/timezone.ini
#RUN echo "extension=/usr/lib/php5/20131226/xsl.so" >> /usr/local/etc/php/conf.d/xsl.ini # TODO: Debian is putting the xsl extension in a different directory, should be in: /usr/local/lib/php/extensions/no-debug-non-zts-20131226
RUN echo "zend_extension=/usr/local/lib/php/extensions/no-debug-non-zts-20100525/xdebug.so" >> /usr/local/etc/php/conf.d/xdebug.ini

# Install and setup composer
RUN wget https://getcomposer.org/download/1.0.3/composer.phar
RUN mv composer.phar /usr/local/bin/composer
RUN chmod a+x /usr/local/bin/composer

ENV COMPOSER_HOME /root/composer

# Add composer bin to the environment
ENV PATH=/root/composer/vendor/bin:$PATH

COPY composer.json /root/composer/

# Install development tools, prefer source removed as automatic fallback now
RUN composer global install
