
FROM php:5.5-apache

# Install PHP extension dependencies (if any)
#RUN apt-get update \
#    && apt-get -y --no-install-recommends install <package_name>

# Copy PHP configuration
# Edit docker/php.ini and customize it to your needs
COPY docker/php.ini /usr/local/etc/php/php.ini

# Copy custom command docker-php-pecl-install
COPY docker/docker-php-pecl-install /usr/local/bin/

# Install PHP extensions
RUN docker-php-ext-install mysql
RUN docker-php-ext-install mysqli
RUN docker-php-ext-install pdo
RUN docker-php-ext-install pdo_mysql
 
#RUN docker-php-ext-install iconv mysqli pdo pdo_mysql
# Install PECL extensions
#RUN docker-php-pecl-install <package_name-version> (versions available in PECL repository allowed)

# If you are using XDebug, this might be useful, if not, ignore it
# You additionally will have to customize docker/xdebug-ini-overrides.ini file to your needs
#RUN docker-php-pecl-install xdebug-2.5.4
#COPY docker/xdebug-ini-overrides.ini /usr/local/etc/php/conf.d/docker-php-pecl-xdebug.ini

# Configure Apache VHOSTS
#COPY docker/mysite.com.conf /etc/apache2/sites-available/mysite.com.conf
#RUN a2ensite <mysite.com.conf>

# Activate Apache modules
#RUN a2enmod <module_name>
#RUN service apache2 restart
# Install ssl-cert (snakeoil) package
RUN set -eux; \
  sudo apt-get update && apt-get install -y ssl-cert libfreetype6-dev libjpeg62-turbo-dev libpng-dev libssl-dev pkg-config; \
  : "Clean Apt system" ;\
  apt-get clean; \
  rm -rf /var/lib/apt/lists/*; \
  rm -rf /tmp/* /var/tmp/* /var/log/lastlog /var/log/faillog; \
  rm -f /var/log/{apt/*,alternatives.log,dpkg.log}; \
  :;

  RUN a2enmod rewrite && a2enmod ssl && a2enmod socache_shmcb
  RUN sed -i '/SSLCertificateFile.*snakeoil.pem/cSSLCertificateFile /etc/ssl/certs/mycert.crt' /etc/apache2/sites-available/default-ssl.conf && sed -i '/SSLCertificateKeyFile.*snakeoil.key/cSSLCertificateKeyFile /etc/ssl/private/mycert.key' /etc/apache2/sites-available/default-ssl.conf
 RUN a2ensite default-ssl


# Set the workdir
#WORKDIR /var/www/docker-lamp-php-5