Commit aca4277f authored by Vladas Keparoutis's avatar Vladas Keparoutis
Browse files

TEst dockerfile

parent 38f172dc
###########################################################
# Dockerfile to build WCMS container images
# Based on php7.2-apache
# THis file is to be ignored
############################################################
## Set the base image to Ubuntu
FROM php:7.2-apache-stretch
## Pass the argument variables from the docker-compose file to the Dockerfile and echo them out
ARG PHP_VERSION8
ARG DRUPAL8_VERSION
ARG PROJECT_BASE_URL
RUN echo "PHP version: $PHP_VERSION8"
RUN echo "Drupal 8 version: $DRUPAL8_VERSION"
RUN echo "Project base URL: $PROJECT_BASE_URL"
RUN apt-get update && apt-get install -y apt-transport-https gnupg2
## To avoid getting the warning about apt-key stdout...
ENV APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=DontWarn
## Added so we can installs 8.x branch of nodejs.
RUN curl -sL https://deb.nodesource.com/setup_8.x | bash -
## Added so we can install yarn for Drupal8 theme work.
RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
RUN echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list
RUN apt-get update -y && apt-get install -y \
git \
vim \
libpng-dev \
libgd-dev \
libfreetype6-dev \
libjpeg62-turbo-dev \
libldap2-dev \
optipng \
jpegoptim \
imagemagick \
nano \
mysql-client \
openssh-server \
pdftk \
wget \
bzip2 \
yarn \
ruby-sass \
ruby-compass \
nodejs \
dos2unix \
sudo \
supervisor \
gcc-6-base \
libasound2
RUN /usr/local/bin/docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/
RUN /usr/local/bin/docker-php-ext-install gd ldap zip pdo_mysql opcache
RUN apt-get clean
COPY ./apache/server.crt /etc/ssl/certs/server.crt
COPY ./apache/server.key /etc/ssl/private/server.key
## Replace the default site configuration with our own.
COPY ./apache/drupal8.conf /etc/apache2/sites-available/drupal8.conf
COPY ./apache/drupal8alt.conf /etc/apache2/sites-available/drupal8alt.conf
COPY ./apache/default-ssl.conf /etc/apache2/sites-available/default-ssl.conf
COPY ./apache/wcms-common.conf /etc/apache2/conf-available/wcms-common.conf
COPY ./apache/php.ini /usr/local/etc/php
## Enable mod_rewrite 'cause we needs it.
RUN a2enmod rewrite
## Enable SSL
RUN a2enmod ssl
## for Content Security Policy (CSP).
RUN a2enmod headers
## Install the latest npm and gulp so we have them for responsive sites.
RUN npm install npm@latest -g \
npm install gulp@3.9.1 -g \
npm install bower -g
## Create a symlink for node to nodejs.
## RUN ln -s /usr/bin/nodejs /usr/bin/node
## Install Composer
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
## Add the "vagrant" user (because we are all familiar with having it)
RUN useradd -d /home/vagrant -m -s /bin/bash -g www-data -G sudo vagrant
RUN echo "vagrant:vagrant" | chpasswd
## Forward logs to docker log collector.
RUN ln -sf /dev/stdout /var/log/apache2/access.log && \
ln -sf /dev/stderr /var/log/apache2/error.log && \
ln -sf /dev/stdout /var/log/apache2/000_default-access_log && \
ln -sf /dev/stderr /var/log/apache2/000_default-error_log
## Copy our custom entrypoint and make it executable.
COPY docker-entrypoint.sh /usr/local/bin/
RUN chmod +x /usr/local/bin/docker-entrypoint.sh
## Clone PatternLab into the html directory.
RUN git clone https://git.uwaterloo.ca/wcms/uw_wcms_pattern_lab.git /var/www/html/uw_wcms_pattern_lab
RUN echo "Cloned patternlab..."
## Add drush 8
RUN wget https://github.com/drush-ops/drush/releases/download/8.3.0/drush.phar && \
chmod +x drush.phar && \
mv drush.phar /usr/local/bin/drush
## Install the drush registry_rebuild module
RUN drush @none dl registry_rebuild-7.x
## Add xdebug config
RUN yes | pecl install xdebug \
docker-php-ext-enable xdebug; \
echo 'zend_extension=xdebug.so' >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini; \
echo 'xdebug.remote_enable=1' >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini; \
echo 'xdebug.remote_host=host.docker.internal' >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini; \
echo 'xdebug.remote_port=9011' >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini; \
echo 'xdebug.remote_log=/tmp/xdebug.log' >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini; \
echo 'xdebug.remote_connect_back=0' >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini; \
echo 'xdebug.max_nesting_level=256' >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini;
##Manually set up the apache environment variables
ENV APACHE_RUN_USER www-data
ENV APACHE_RUN_GROUP www-data
ENV APACHE_LOG_DIR /var/log/apache2
ENV APACHE_LOCK_DIR /var/lock/apache2
ENV APACHE_PID_FILE /var/run/apache2.pid
COPY ./apache/servername.conf /etc/apache2/conf-available
RUN a2enconf servername
## Expose the default Apache port.
EXPOSE 80
EXPOSE 443
## Replace the standard entrypoint /bin/sh with our script.
ENTRYPOINT ["docker-entrypoint.sh"]
## If no command is passed to the container, start Apache by default.
CMD ["apachectl", "-D", "FOREGROUND"]
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment