FROM php:5.6-apache
MAINTAINER Joel Vasquez <vasquezader@gmail.com>

RUN requirements=" vim libgd-dev libpng16-16 libcurl4-openssl-dev libmcrypt-dev libicu-dev libpq-dev libmcrypt4 libfreetype6-dev libjpeg62-turbo-dev libpng-dev libjpeg-dev zlib1g-dev gnupg software-properties-common devscripts -qy" \
    && apt-get update && apt-get install -y $requirements \
    && docker-php-ext-install pdo_pgsql \
    && docker-php-ext-install mcrypt \
    && docker-php-ext-install mbstring \
    && docker-php-ext-install intl \
    && docker-php-ext-install pcntl \
	&& docker-php-ext-install curl \
	&& docker-php-ext-install -j$(nproc) iconv \
    && docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-png-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \
    && docker-php-ext-install gd
    #&& rm -rf /var/lib/apt/lists/*


#RUN curl -sSL https://getcomposer.org/installer | php \
#    && mv composer.phar /usr/local/bin/composer \
#    && apt-get update \
#    && apt-get install -y zlib1g-dev git \
#    && docker-php-ext-install zip \
    #&& apt-get purge -y --auto-remove zlib1g-dev \
    #&& rm -rf /var/lib/apt/lists/*

RUN curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" \
    && apt-get install unzip -qy \
    && unzip awscliv2.zip \
    && ./aws/install
	

COPY ./docker/apache/default.conf /etc/apache2/sites-available/000-default.conf

RUN a2enmod rewrite

# Use the default production configuration
RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini"

# Override with custom opcache settings
COPY ./docker/php/my-php.ini $PHP_INI_DIR/conf.d/

RUN service apache2 restart 

# Cuando se pase a PRD el codigo se compila en un empaquetado.
#COPY . /var/www/html/plus/
#COPY ./docker/cakephp/plus.php /var/www/genesis/plus.php

# Add cake and composer command to system path
#ENV PATH="${PATH}:/var/www/html/plus/lib/Cake/Console"
#ENV PATH="${PATH}:/var/www/html/plus/app/Vendor/bin"

RUN usermod -u 1000 www-data
RUN chown -R www-data:www-data /var/www/