Skip to content

Instantly share code, notes, and snippets.

@mparker17
Last active May 8, 2017 14:08
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save mparker17/6202abceee002d62c72c to your computer and use it in GitHub Desktop.
Save mparker17/6202abceee002d62c72c to your computer and use it in GitHub Desktop.
Docker-compose templates for D7, D8
#
# Minimal Drupal 7.x development environment.
#
# Use:
# 1. Place a copy of this file at your Drupal site root.
# 2. Start the web stack: `USER_ID=$(id -u) docker-compose up -d`
# 3. Set up `settings.local.php` (note that the host is 'db' and the username,
# password, and schema are in the environment variables for the database
# container below).
# 4. If you have a database dump to import, place it in your Drupal site root,
# then import it with:
# USER_ID=$(id -u) docker-compose run --rm drush sqlq --file="$filename"
# 5. When you're done, stop the web stack:
# `USER_ID=$(id -u) docker-compose stop`
#
# To delete all the containers, run `USER_ID=$(id -u) docker-compose rm`. Note
# this will delete the "db" container, which will delete your database.
#
# You can leave out the `USER_ID=$(id -u)` if you add that line to your shell's
# configuration.
#
# Run Drush commands with:
# USER_ID=$(id -u) docker-compose run --rm drush $rest_of_drush_command
#
version: '2'
services:
web:
image: "drupal:7"
working_dir: "/var/www/html"
volumes:
- ".:/var/www/html"
links:
- "db"
ports:
- "80"
db:
image: "mariadb:latest"
environment:
- MYSQL_ROOT_PASSWORD=root
- MYSQL_USER=drupal
- MYSQL_PASSWORD=drupal
- MYSQL_DATABASE=drupal
volumes:
- ".:/var/www/html"
ports:
- "3306"
drush:
image: "mparker17/mush"
working_dir: "/var/www/html"
volumes:
- ".:/var/www/html"
links:
- "db"
#
# Minimal Drupal 8.0.x development environment.
#
# Use:
# 1. Place a copy of this file at your Drupal site root.
# 2. Start the web stack: `USER_ID=$(id -u) docker-compose up -d`
# 3. Set up `settings.local.php` (note that the host is 'db' and the username,
# password, and schema are in the environment variables for the database
# container below).
# 4. If you have a database dump to import, place it in your Drupal site root,
# then import it with:
# USER_ID=$(id -u) docker-compose run --rm drush sqlq --file="$filename"
# 5. When you're done, stop the web stack:
# `USER_ID=$(id -u) docker-compose stop`
#
# To delete all the containers, run `USER_ID=$(id -u) docker-compose rm`. Note
# this will delete the "db" container, which will delete your database.
#
# You can leave out the `USER_ID=$(id -u)` if you add that line to your shell's
# configuration.
#
# Run Drush commands with:
# USER_ID=$(id -u) docker-compose run --rm drush $rest_of_drush_command
# Run Drupal Console commands with:
# USER_ID=$(id -u) docker-compose run --rm console $rest_of_drupal_console_command
#
version: '2'
services:
web:
image: "drupal:8"
working_dir: "/var/www/html"
volumes:
- ".:/var/www/html"
links:
- "db"
ports:
- "80"
db:
image: "mariadb:latest"
environment:
- MYSQL_ROOT_PASSWORD=root
- MYSQL_USER=drupal
- MYSQL_PASSWORD=drupal
- MYSQL_DATABASE=drupal
volumes:
- ".:/var/www/html"
ports:
- "3306"
drush:
image: "drush/drush"
working_dir: "/var/www/html"
volumes:
- ".:/var/www/html"
links:
- "db"
console:
image: "mparker17/drupalconsole"
working_dir: "/var/www/html"
volumes:
- ".:/var/www/html"
links:
- "db"
# Copy this snippet into your docker-compose.yml file's services: key to
# automatically compile SASS files with compass.
#
# This assumes your theme is at `./themes/custom/yourtheme`, which is probably
# not the case for your project: customize the `volumes` directive as
# appropriate.
#
# This will probably work a lot better if you set up a `config.rb` file in the
# theme's directory. An example one is at
# https://gist.github.com/mparker17/4319ac3f3fa4c9e5d56c
compass:
image: "mparker17/compass"
command: "watch"
user: "$USER_ID"
working_dir: "/theme"
volumes:
- "./themes/custom/yourtheme:/theme"
# Copy this snippet into your docker-compose.yml file's services: key to add an
# bg-sync container, and remove the ".:" in front of all volumes, if applicable.
# Only necessary on macOS, while Docker's built-in sync is abysmally slow
# (true as of 1.13.0-rc3). See https://github.com/docker/for-mac/issues/77
bg-sync:
image: "cweagans/bg-sync"
volumes:
- ".:/source"
volumes_from:
- web
environment:
- SYNC_DESTINATION=/var/www/html
- SYNC_VERBOSE=1
# Copy this snippet into your docker-compose.yml file's services: key to add an
# OpenLDAP container.
ldap:
image: "dinkel/openldap"
environment:
- SLAPD_PASSWORD=openldap
- SLAPD_DOMAIN=localhost
- SLAPD_CONFIG_PASSWORD=openldap
volumes:
- "/etc/ldap"
- "/var/lib/ldap"
ports:
- "389"
# Copy this snippet into your docker-compose.yml file's services: key to add a
# memcached container.
memcached:
image: "memcached:1"
ports:
- "11211"
# Copy this snippet into your docker-compose.yml file's services: key to add a
# Solr container pre-configured with the Search API config.
#
# The solr container will have one core, named "collection1" by default.
# However, you can override it using the SOLR_CORE_NAME environment variable.
#
# I recommend using https://www.drupal.org/project/search_api_override with a
# corresponding entry in settings[.local].php (e.g.:
# https://github.com/mparker17/drupal7-settings_local_snippets/blob/master/search_api_override.php).
solr:
image: "mparker17/solr-search-api-solr"
environment:
- SOLR_CORE_NAME=collection1
ports:
- "8983"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment