11#! /usr/bin/env bash
22set -e
33
4- if [ ! -d " $MOODLE_DOCKER_WWWROOT " ];
5- then
6- echo ' Error: $MOODLE_DOCKER_WWWROOT is not set or not an existing directory'
7- exit 1
8- fi
9-
10- if [ -z " $MOODLE_DOCKER_DB " ];
11- then
12- echo ' Error: $MOODLE_DOCKER_DB is not set'
13- exit 1
14- fi
15-
164# Nasty portable way to the directory of this script, following symlink,
175# because readlink -f not on OSX. Thanks stack overflow..
186SOURCE=" ${BASH_SOURCE[0]} "
2412basedir=" $( cd -P " $( dirname " $SOURCE " ) /../" && pwd ) "
2513export ASSETDIR=" ${basedir} /assets"
2614
15+ if [ -f " ${basedir} /.env" ];
16+ then
17+ . " ${basedir} /.env"
18+ fi
19+
20+ if [ ! -d " $MOODLE_DOCKER_WWWROOT " ];
21+ then
22+ echo ' Error: $MOODLE_DOCKER_WWWROOT is not set or not an existing directory'
23+ exit 1
24+ fi
25+
26+ if [ -z " $MOODLE_DOCKER_DB " ];
27+ then
28+ echo ' Error: $MOODLE_DOCKER_DB is not set'
29+ exit 1
30+ fi
2731
2832dockercompose=" docker-compose -f ${basedir} /base.yml"
2933dockercompose=" ${dockercompose} -f ${basedir} /service.mail.yml"
@@ -35,7 +39,6 @@ export MOODLE_DOCKER_PHP_VERSION=${MOODLE_DOCKER_PHP_VERSION:-7.1}
3539if [ " $MOODLE_DOCKER_DB " != ' pgsql' ];
3640then
3741 dockercompose=" ${dockercompose} -f ${basedir} /db.${MOODLE_DOCKER_DB} .yml"
38-
3942fi
4043
4144# Support PHP version overrides for DB..
7477 dockercompose=" ${dockercompose} -f ${basedir} /webserver.port.yml"
7578fi
7679
77-
7880# Mac OS Compatbility
7981if [[ " $( uname) " == " Darwin" ]]; then
8082 # Support https://docs.docker.com/docker-for-mac/osxfs-caching/
8183 dockercompose=" ${dockercompose} -f ${basedir} /volumes-cached.yml"
8284fi
8385
84-
8586$dockercompose $@
0 commit comments