# Use the official PHP 5.6 Apache image for classic mod_php FROM php:5.6-apache # Install required system libraries and PHP extensions for CakePHP RUN sed -i 's|http://deb.debian.org/debian|http://archive.debian.org/debian|g' /etc/apt/sources.list && \ sed -i 's|http://security.debian.org/debian-security|http://archive.debian.org/debian-security|g' /etc/apt/sources.list && \ sed -i '/stretch-updates/d' /etc/apt/sources.list && \ echo 'Acquire::AllowInsecureRepositories "true";' > /etc/apt/apt.conf.d/99allow-insecure && \ echo 'Acquire::AllowDowngradeToInsecureRepositories "true";' >> /etc/apt/apt.conf.d/99allow-insecure && \ apt-get update && \ apt-get install --allow-unauthenticated -y libc-client2007e-dev libkrb5-dev libpng-dev libjpeg-dev libfreetype6-dev libcurl4-openssl-dev libxml2-dev libssl-dev libmcrypt-dev libicu-dev && \ docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ && \ docker-php-ext-configure imap --with-kerberos --with-imap-ssl && \ docker-php-ext-install mysqli pdo pdo_mysql mbstring gd curl imap # Set environment variables. ENV HOME /root # Define working directory. WORKDIR /root ARG COMMIT ENV COMMIT_SHA=${COMMIT} EXPOSE 80 # Legacy apt compatibility and install steps for Ubuntu 16.04 (now commented out) # RUN sed -i 's|http://archive.ubuntu.com/ubuntu/|http://old-releases.ubuntu.com/ubuntu/|g' /etc/apt/sources.list && \ # sed -i 's|http://security.ubuntu.com/ubuntu|http://old-releases.ubuntu.com/ubuntu|g' /etc/apt/sources.list # RUN apt-get update # RUN apt-get -y upgrade # RUN echo 'Acquire::AllowInsecureRepositories "true";' > /etc/apt/apt.conf.d/99allow-insecure # RUN apt-get update -o Acquire::AllowInsecureRepositories=true --allow-unauthenticated # RUN DEBIAN_FRONTEND=noninteractive apt-get -y install apache2 libapache2-mod-php5 php5-mysql php5-gd php-pear php-apc php5-curl php5-imap # RUN a2enmod php5 # RUN php5enmod openssl # RUN sed -i "s/short_open_tag = Off/short_open_tag = On/" /etc/php5/apache2/php.ini # RUN sed -i "s/error_reporting = .*$/error_reporting = E_ERROR | E_WARNING | E_PARSE/" /etc/php5/apache2/php.ini # ADD conf/php.ini /etc/php5/apache2/php.ini # Copy vhost config to Apache's sites-available ADD conf/apache-vhost.conf /etc/apache2/sites-available/cmc-sales.conf ADD conf/ripmime /bin/ripmime RUN chmod +x /bin/ripmime \ && a2ensite cmc-sales \ && a2dissite 000-default \ && a2enmod rewrite \ && a2enmod headers # Copy site into place. ADD php/ /var/www/cmc-sales ADD php/app/config/database_stg.php /var/www/cmc-sales/app/config/database.php RUN mkdir -p /var/www/cmc-sales/app/tmp RUN mkdir -p /var/www/cmc-sales/app/tmp/logs RUN chmod -R 755 /var/www/cmc-sales/app/tmp # Ensure CakePHP tmp directory is writable by web server RUN chmod -R 777 /var/www/cmc-sales/app/tmp # No need to disable proxy_fcgi or remove PHP-FPM conf files in this image # By default, simply start apache. CMD /usr/sbin/apache2ctl -D FOREGROUND