Skip to content

Instantly share code, notes, and snippets.

@geerlingguy
Created December 14, 2018 22:46
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save geerlingguy/5998fe7cd13520498df0578b9ba366ea to your computer and use it in GitHub Desktop.
Save geerlingguy/5998fe7cd13520498df0578b9ba366ea to your computer and use it in GitHub Desktop.
BLT Docker Image Dockerfile
# Note: Your base image should contain all the PHP extensions required by your project.
FROM my/base-drupal-container:latest
# Set the project machine name here.
ENV PROJECT my-blt-project
# Copy the deployment artifact into place.
COPY deploy/ /var/www/$PROJECT
# Copy the Drupal container settings file into place.
COPY docker/settings.container.php /var/www/$PROJECT/docroot/sites/default/settings.container.php
# Set a custom docroot since BLT uses 'docroot'.
ENV APACHE_DOCUMENT_ROOT /var/www/$PROJECT/docroot
RUN sed -ri -e 's!/var/www/html!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/sites-available/*.conf
RUN sed -ri -e 's!/var/www/!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/apache2.conf /etc/apache2/conf-available/*.conf
# Set appropriate permissions on sites/default directory.
RUN chmod 665 /var/www/$PROJECT/docroot/sites/default
# Set appropriate permissions on public files directory.
RUN mkdir -p /var/www/$PROJECT/docroot/sites/default/files \
&& chown www-data:www-data /var/www/$PROJECT/docroot/sites/default/files
WORKDIR /var/www/$PROJECT
@jedgar1mx
Copy link

Is there a way to migrate my current BLT/DruapVM to use docker? I see a lot of documentation on starting a new project but not on migrating existing ones.

Thanks in advance.

@geerlingguy
Copy link
Author

@jedgar1mx - Sort of... it's not really the same using the Docker version of Drupal VM as you use the Vagrant version. I usually recommend people use a different Docker solution like Ddev, Lando, or Docksal if they want to fully switch to using Docker for local dev.

@jedgar1mx
Copy link

I notice that after getting my sites up on docker, all the blt test functionality is gone. Is DrupaVM Docker something on the pipeline? or Am I better off looking into moving to something like Ddev, Lando, or Docksal?

@geerlingguy
Copy link
Author

You'd probably be better moving off to one of those other solutions; Drupal VM's docker functionality is not aligned with the way most of the blt integration is set up to work (note that BLT and Drupal VM are separate but related projects).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment