Last active
January 21, 2018 19:22
-
-
Save jonpemby/b79400caba5ad87d2a9d264b132201ee to your computer and use it in GitHub Desktop.
Starting a new Drupal project with Docker (SQLite)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Change directory to where you want to create your project. | |
# Composer's create-project command creates a project with | |
# a particular vendor package as the base into a provided directory | |
# You can change the project variable to the | |
# preferred folder name for your project | |
export project="project-name" | |
composer create-project drupal/drupal $project | |
cd $project | |
# Here, we get the current directory and store it in $h for our host base directory | |
# and we store the base directory that we want to mount our volumes to on our guest | |
# You can also optionally set the ports here as well. | |
export h=$(pwd) | |
export g="/var/www/html" | |
export host_port="8080" | |
export guest_port="80" | |
# This is where our Docker magic happens: we create a container with | |
# our project's name and provide mounted directories for our profiles, | |
# modules, themes and sites directories as recommended by the Docker Drupal image. :) | |
docker run --name $project -p $host_port:$guest_port -d \ | |
-v $h/profiles:$g/profiles \ | |
-v $h/modules:$g/modules \ | |
-v $h/themes:$g/themes \ | |
-v $h/sites:$g/sites \ | |
drupal |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment