From 554c2da64045f794beeee1789fd9188ef97d5786 Mon Sep 17 00:00:00 2001
From: mnshantz <mnshantz@uwaterloo.ca>
Date: Tue, 28 Aug 2018 11:32:37 -0400
Subject: [PATCH] Cleaning up we dockerfile and making changes to
 docker-compose.

---
 build-scripts/web/Dockerfile | 35 +++++++++++++++++++++++++----------
 docker-compose.yml           | 19 ++++++++++++++++++-
 2 files changed, 43 insertions(+), 11 deletions(-)

diff --git a/build-scripts/web/Dockerfile b/build-scripts/web/Dockerfile
index 5ca5ace..64bf3a1 100644
--- a/build-scripts/web/Dockerfile
+++ b/build-scripts/web/Dockerfile
@@ -39,7 +39,6 @@ RUN apt-get update && \
     apt-get install --assume-yes \
     apache2 \
     nano \
-    yarn \
     openssh-server \
     wget \
     sudo \
@@ -68,7 +67,6 @@ RUN apt-get update && \
     git \
     nodejs \
     yarn \
-    drush \
     ruby-sass \
     ruby-compass \
     mysql-client
@@ -104,6 +102,9 @@ RUN sudo npm install npm@latest -g \
 # 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 -ms /bin/bash -g root -G sudo -p vagrant vagrant
+
 # 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 && \
@@ -118,8 +119,21 @@ RUN chmod +x /usr/local/bin/docker-entrypoint.sh
 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.1.17/drush.phar && \ 
+    chmod +x drush.phar && \
+    mv drush.phar /usr/local/bin/drush
+
+# 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
+
+
 # Clone Drupal
-RUN drush dl -v -d drupal-8.5.5 --destination="/var/www" --drupal-project-rename="drupal8"
+RUN drush dl -v -d drupal-8.5.6 --destination="/var/www" --drupal-project-rename="drupal8"
 RUN echo "Cloned Drupal 8...."
 
 # Clone our WCMS profile
@@ -127,13 +141,14 @@ RUN cd /var/www/drupal8/profiles && \
     git clone https://git.uwaterloo.ca/wcms/uw_base_profile.git && \
     cd /var/www/drupal8/profiles/uw_base_profile && \
     git checkout 8.x-3.x
-
-# 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
+    
+# Create the settings.php file
+RUN cd /var/www/drupal8/sites/default && \
+    cp default.settings.php settings.php
+
+# Add Drupal permissions to the drupal folder
+RUN chown -R vagrant:www-data /var/www/drupal8
+RUN chmod -R g+w /var/www/drupal8
 
 # Expose the default Apache port.
 EXPOSE 80
diff --git a/docker-compose.yml b/docker-compose.yml
index a27dead..0f8b7a6 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -1,6 +1,7 @@
 version: '3'
 services:
   web:
+    container_name: wcms-web
     build: ./build-scripts/web
 
     ports:
@@ -11,7 +12,8 @@ services:
     tty: true
     
   db:
-    image: lullaboteducation/drupaldevwithdocker-mysql
+    container_name: wcms-mysql
+    image: wodby/mariadb
     volumes:
       - ./db-backups:/var/mysql/backups:delegated
     environment:
@@ -21,7 +23,9 @@ services:
       MYSQL_PASSWORD: verybadpassword
     ports:
       - "3306:3306"
+      
   pma:
+    container_name: wcms-phpmyadmin
     image: phpmyadmin/phpmyadmin
     environment:
       PMA_HOST: db
@@ -31,3 +35,16 @@ services:
       PHP_MAX_INPUT_VARS: 1G
     ports:
      - "8001:80"
+     
+  portainer:
+    container_name: wcms-portainer
+    image: portainer/portainer
+    command: -H unix:///var/run/docker.sock
+    ports:
+     - "9000:9000"
+    volumes:
+      - /var/run/docker.sock:/var/run/docker.sock
+      - portainer_data:/data
+
+volumes:
+  portainer_data:
\ No newline at end of file
-- 
GitLab