Skip to content
Snippets Groups Projects
Commit 9dbebea5 authored by Chris Shantz's avatar Chris Shantz
Browse files

Adding a dev branch for Drupal8 with patternlab.

parents
No related branches found
No related tags found
No related merge requests found
FROM ubuntu:xenial
################################################################################
# #
# THIS CONTAINER IS FOR EDUCATIONAL USE ONLY! #
# #
# Never use this container for running production workloads! #
# #
################################################################################
## Pre-configure mysql username and password
RUN echo "mysql-server mysql-server/root_password password root" | debconf-set-selections
RUN echo "mysql-server mysql-server/root_password_again password root" | debconf-set-selections
# Update the package manager, then install MySQL server.
RUN apt-get update && apt-get install -y mysql-server
# Reconfigure the bind address of MySQL to allow any incoming network connection.
RUN sed -i -e "s/^bind-address\s*=\s*127.0.0.1/bind-address = 0.0.0.0/" /etc/mysql/mysql.conf.d/mysqld.cnf
# Copy our custom entrypoint and make it executable.
COPY docker-entrypoint.sh /usr/local/bin/
RUN chmod +x /usr/local/bin/docker-entrypoint.sh
# Mark the MySQL directory as a volume.
VOLUME /var/lib/mysql
# Expose the default MySQL port.
EXPOSE 3306
# Replace the standard entrypoint /bin/sh with our script.
ENTRYPOINT ["docker-entrypoint.sh"]
# If no command is passed to the container, start the MySQL server by default.
CMD ["/usr/bin/mysqld_safe"]
#!/usr/bin/env bash
# Any background job should have it's messages printed.
set -m
# Don't continue if any command in the script fails.
set -e
# Create the lock file directory.
mkdir -p -m 777 /var/run/mysqld/
# Define some variables, setting default values if necessary.
MYSQL_DATABASE=${MYSQL_DATABASE:-wcms_db}
MYSQL_USER=${MYSQL_USER:-mysql}
MYSQL_PASSWORD=${MYSQL_PASSWORD:-password}
MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD:-root}
ADDITIONAL_DATABASES=${ADDITIONAL_DATABASES:-}
# Start the MySQL server in the background.
mysqld_safe &
# Wait a moment for MySQL to fully start up.
sleep 10
# Change the root password and grant remote access.
# Normally, this is a VERY BAD IDEA, but it's fine for local development.
mysql -u root -e "GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '${MYSQL_ROOT_PASSWORD}';"
# Create a database with the given name, user, and password.
mysql -u root -e "CREATE DATABASE IF NOT EXISTS ${MYSQL_DATABASE}"
mysql -u root -e "GRANT ALL ON ${MYSQL_DATABASE}.* to '${MYSQL_USER}'@'%' IDENTIFIED BY '${MYSQL_PASSWORD}'"
# Create any additional databases if we asked for them.
if [ -n "$ADDITIONAL_DATABASES" ]; then
for ADD_DB_NAME in $ADDITIONAL_DATABASES; do
mysql -u root -e "CREATE DATABASE IF NOT EXISTS $ADD_DB_NAME"
mysql -u root -e "GRANT ALL ON \`$ADD_DB_NAME\`.* TO '$MYSQL_USER'@'%' ;"
done;
fi
# Flush any priviledges
mysql -u root -e "FLUSH PRIVILEGES"
# Shutdown our mysql server running in the background.
mysqladmin shutdown
# Now that we're set up, run whatever command was passed to the entrypoint.
exec "$@"
<VirtualHost *:80>
DocumentRoot /var/www/drupal
ServerAdmin webmaster@localhost
ServerName docker8
Redirect permanent / https://docker8/
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
</VirtualHost>
<VirtualHost *:443>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/drupal
ServerName docker8
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
ErrorLog /error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog /access.log combined
SSLEngine on
SSLCertificateFile /etc/ssl/certs/server.crt
SSLCertificateKeyFile /etc/ssl/private/server.key
Alias /doc/ /usr/share/doc/
<Directory /usr/share/doc/>
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Allow from 127.0.0.0/255.0.0.0 ::1/128
</Directory>
</VirtualHost>
\ No newline at end of file
FROM ubuntu:xenial
################################################################################
# #
# THIS CONTAINER IS FOR EDUCATIONAL USE ONLY! #
# #
# Never use this container for running production workloads! #
# #
################################################################################
RUN export DEBIAN_FRONTEND=noninteractive
RUN apt-get update && \
apt-get install --assume-yes \
software-properties-common \
language-pack-en \
curl \
apt-transport-https
## 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
## Added so we can installs 8.x branch of nodejs.
RUN curl -sL https://deb.nodesource.com/setup_8.x | bash -
RUN apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xF1656F24C74CD1D8
RUN export LANG=en_US.UTF-8
## For ubuntu xenial we need to add some repos for the latest PHP version
RUN export DEBIAN_FRONTEND=noninteractive
RUN LC_ALL=en_US.UTF-8 add-apt-repository -y ppa:ondrej/php
## Pre-configure mysql username and password
RUN echo "mysql-server mysql-server/root_password password root" | debconf-set-selections
RUN echo "mysql-server mysql-server/root_password_again password root" | debconf-set-selections
# Update the package manager, then install packages.
RUN apt-get update && \
apt-get install --assume-yes \
apache2 \
openssh-server \
wget \
sudo \
php7.2 \
libapache2-mod-php7.2 \
php7.2-mysql \
php7.2-cli \
php7.2-common \
php7.2-gd \
php7.2-mbstring \
php7.2-xml \
php7.2-opcache \
php7.2-sqlite3 \
php7.2-mysql \
php7.2-curl \
php7.2-soap \
php7.2-phar \
php7.2-cgi \
php-uploadprogress \
php-pear \
optipng \
jpegoptim \
imagemagick \
libapache2-mod-fcgid \
libapache2-mod-fastcgi \
git \
nodejs \
drush \
ruby-sass \
ruby-compass \
mysql-client
## From https://www.digitalocean.com/community/tutorials/how-to-create-a-ssl-certificate-on-apache-for-ubuntu-14-04
RUN cd /tmp
RUN openssl req -x509 -nodes -days 1825 -newkey rsa:2048 -keyout /tmp/apache.key -out /tmp/apache.crt \
-subj "/C=CA/ST=ON/L=Waterloo/O=uWaterloo/OU=IST/CN=wcms-devsite/emailAddress=localhost@example.com"
RUN cp /tmp/apache.crt /etc/ssl/certs/server.crt
RUN cp /tmp/apache.key /etc/ssl/private/server.key
# Replace the default site configuration with our own.
COPY 000-default.conf /etc/apache2/sites-available/000-default.conf
# 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 sudo npm install npm@latest -g \
sudo npm install gulp -g \
sudo npm install bower -g
## Create a symlink for node to nodejs.
## RUN ln -s /usr/bin/nodejs /usr/bin/node
# 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
# 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"]
\ No newline at end of file
#!/usr/bin/env bash
# Any background job should have it's messages printed.
set -m
# Don't continue if any command in the script fails.
set -e
# Delete any previously existing run file.
if [ -f /run/apache2/apache2.pid ]; then
rm /run/apache2/apache2.pid
fi
# Allow the Apache docroot to be overridden.
APACHE_DOCROOT_DIR="${APACHE_DOCROOT_DIR:-/var/www/html}"
if [ -n "$APACHE_DOCROOT_DIR" ]; then
sed -i 's@^\s*DocumentRoot.*@'" DocumentRoot ${APACHE_DOCROOT_DIR}"'@' /etc/apache2/sites-available/000-default.conf
fi
# Allow the site name to be overriden.
APACHE_SITE_NAME="${APACHE_SITE_NAME:-docker.test}"
if [ -n "$APACHE_SITE_NAME" ]; then
sed -i 's@^\s*ServerName.*@'" ServerName ${APACHE_SITE_NAME}"'@' /etc/apache2/sites-available/000-default.conf
fi
# Allow for site aliases to be provided.
APACHE_SITE_ALIAS="${APACHE_SITE_ALIAS:-docker.localhost}"
if [ -n "$APACHE_SITE_ALIAS" ]; then
sed -i 's@^\s*ServerAlias.*@'" ServerAlias ${APACHE_SITE_ALIAS}"'@' /etc/apache2/sites-available/000-default.conf
fi
# Now that we're set up, run whatever command was passed to the entrypoint.
exec "$@"
This diff is collapsed.
version: '3'
services:
web:
build: ./build-scripts/web
volumes:
- ./docroot/drupal:/var/www/drupal
- ./docroot/uwpatternlab:/var/www/html/uw_wcms_pattern_lab
ports:
- "80:80"
- "443:443"
stdin_open: true
tty: true
db:
image: lullaboteducation/drupaldevwithdocker-mysql
volumes:
- ./db-backups:/var/mysql/backups:delegated
environment:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: drupaldb
MYSQL_USER: drupal
MYSQL_PASSWORD: verybadpassword
ports:
- "3306:3306"
pma:
image: phpmyadmin/phpmyadmin
environment:
PMA_HOST: db
PMA_USER: root
PMA_PASSWORD: root
PHP_UPLOAD_MAX_FILESIZE: 1G
PHP_MAX_INPUT_VARS: 1G
ports:
- "8001:80"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment