Merge branch 'multi-sites' of https://github.com/tjb328/laradock into multiple-projects

* 'multi-sites' of https://github.com/tjb328/laradock:
  Fix typo
  Allow for config of crush and opcache in the main docker file
  This is a better Drupal nginx config. Built from a combination of contributions from here: https://groups.drupal.org/node/305633 https://www.nginx.com/resources/wiki/start/topics/recipes/drupal/
  Add Drush and Opcache to laradock because they are needed for drupal development.
  Add drupal 8 example to make laradock framework agnostic.
This commit is contained in:
Mahmoud Zalt 2016-08-17 01:53:55 +03:00
commit 9a77c8e276
5 changed files with 99 additions and 0 deletions

View File

@ -11,6 +11,7 @@ services:
- INSTALL_MONGO=false - INSTALL_MONGO=false
- INSTALL_XDEBUG=false - INSTALL_XDEBUG=false
- INSTALL_NODE=false - INSTALL_NODE=false
- INSTALL_DRUSH=false
- COMPOSER_GLOBAL_INSTALL=false - COMPOSER_GLOBAL_INSTALL=false
- PUID=1000 - PUID=1000
- PGID=1000 - PGID=1000
@ -33,6 +34,7 @@ services:
- INSTALL_XDEBUG=false - INSTALL_XDEBUG=false
- INSTALL_ZIP_ARCHIVE=false - INSTALL_ZIP_ARCHIVE=false
- INSTALL_MEMCACHED=false - INSTALL_MEMCACHED=false
- INSTALL_OPCACHE=false
dockerfile: Dockerfile-70 dockerfile: Dockerfile-70
volumes_from: volumes_from:
- volumes_source - volumes_source

View File

@ -0,0 +1,59 @@
server {
listen 80;
listen [::]:80;
#domain name
server_name drupal8.dev;
#file document root. This has to match one of the volumes in docer-composer.yml
root /var/www/drupal8;
# This is the full path to your index file
index index.php index.html index.htm;
## serve imagecache files directly or redirect to drupal if they do not exist.
location ~* files/styles {
access_log off;
expires 30d;
try_files $uri @drupal;
}
## serve imagecache files directly or redirect to drupal if they do not exist.
location ~* ^.+.(xsl|xml)$ {
access_log off;
expires 1d;
try_files $uri @drupal;
}
## Images and static content is treated different
location ~* ^.+.(jpg|jpeg|gif|css|png|js|ico|xml)$ {
access_log off;
expires 30d;
}
location / {
index index.php;
# This is cool because no php is touched for static content
try_files $uri $uri/ @rewrite;
expires max;
}
location @drupal {
rewrite ^/(.*)$ /index.php?q=$1 last;
}
location @rewrite {
# Some modules enforce no slash (/) at the end of the URL
# Else this rewrite block wouldn't be needed (GlobalRedirect)
rewrite ^/(.*)$ /index.php?q=$1;
}
location ~ .php$ {
fastcgi_pass php-upstream;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}

View File

@ -89,6 +89,16 @@ RUN if [ ${INSTALL_MEMCACHED} = true ]; then \
docker-php-ext-enable memcached \ docker-php-ext-enable memcached \
;fi ;fi
#####################################
# Opcache:
#####################################
ARG INSTALL_OPCACHE=true
ENV INSTALL_OPCACHE ${INSTALL_OPCACHE}
RUN if [ ${INSTALL_OPCACHE} = true ]; then \
docker-php-ext-install opcache && \
docker-php-ext-enable opcache \
;fi
# #
#-------------------------------------------------------------------------- #--------------------------------------------------------------------------

View File

@ -100,6 +100,17 @@ RUN if [ ${INSTALL_MEMCACHED} = true ]; then \
&& docker-php-ext-enable memcached \ && docker-php-ext-enable memcached \
;fi ;fi
#####################################
# Opcache:
#####################################
ARG INSTALL_OPCACHE=true
ENV INSTALL_OPCACHE ${INSTALL_OPCACHE}
RUN if [ ${INSTALL_OPCACHE} = true ]; then \
docker-php-ext-install opcache && \
docker-php-ext-enable opcache \
;fi
# #
#-------------------------------------------------------------------------- #--------------------------------------------------------------------------

View File

@ -37,6 +37,7 @@ MAINTAINER Mahmoud Zalt <mahmoud@zalt.me>
# - INSTALL_MONGO= false # - INSTALL_MONGO= false
# - COMPOSER_GLOBAL_INSTALL= false # - COMPOSER_GLOBAL_INSTALL= false
# - INSTALL_NODE= false # - INSTALL_NODE= false
# - INSTALL_DRUSH= false
# #
##################################### #####################################
@ -97,6 +98,22 @@ RUN if [ ${COMPOSER_GLOBAL_INSTALL} = true ]; then \
composer global install \ composer global install \
;fi ;fi
#####################################
# Drush:
#####################################
USER root
ENV DRUSH_VERSION 8.1.2
ARG INSTALL_DRUSH=true
ENV INSTALL_DRUSH ${INSTALL_DRUSH}
RUN if [ ${INSTALL_DRUSH} = true ]; then \
# Install Drush 8 with the phar file.
curl -fsSL -o /usr/local/bin/drush https://github.com/drush-ops/drush/releases/download/$DRUSH_VERSION/drush.phar | bash && \
chmod +x /usr/local/bin/drush && \
drush core-status \
;fi
USER laradock
##################################### #####################################
# Node / NVM: # Node / NVM:
##################################### #####################################