Skip to content

Instantly share code, notes, and snippets.

@mortenson
Last active August 7, 2016 17:43
Show Gist options
  • Save mortenson/e54511943654ad8313de4894240db28d to your computer and use it in GitHub Desktop.
Save mortenson/e54511943654ad8313de4894240db28d to your computer and use it in GitHub Desktop.
No-interaction Drupal 8 standard install with Docker
# Extend the official Drupal image.
FROM drupal:8.1.7-apache
# Install required binaries.
RUN apt-get update && apt-get install netcat mysql-client -y
# Safely remove the normal modules directory.
RUN rm /var/www/html/modules/README.txt && rmdir /var/www/html/modules
# Install Composer.
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
# Update PATH variable to include Composer binaries.
ENV PATH "/root/.composer/vendor/bin:$PATH"
# Install Drush via Composer.
RUN composer global require drush/drush:8.1.3
# Install Drupal and/or provide the user with a login link.
CMD until nc -z database 3306 > /dev/null; do echo 'Waiting for a database connection...'; sleep 5; done && \
[ ! -f /var/www/html/sites/default/settings.php ] && drush si standard -y --db-url=mysql://drupal:drupal@database:3306/drupal; \
echo "######\nDrupal is ready! Visit" `drush uli -l http://localhost:8000` "to login.\n######"; \
apache2-foreground
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment