Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions bin/moodle-compose
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ fi
if [ -r "$MOODLE_DOCKER_WWWROOT/projectinfo.yml" ]; then
MOODLE_CODENAME=$(grep -e '^codename' "$MOODLE_DOCKER_WWWROOT/projectinfo.yml" | awk -F ': ' '{print $2}')
MOODLE_DB_TYPE=$(grep -e '^sqltype' "$MOODLE_DOCKER_WWWROOT/projectinfo.yml" | awk -F ': ' '{print $2}')
MOODLE_DOCKER_THEMEDEVEL=$(grep -e '^themedevel' "$MOODLE_DOCKER_WWWROOT/projectinfo.yml" | awk -F ': ' '{print $2}')
fi

if [ -z "${MOODLE_CODENAME}" ]; then
Expand All @@ -42,6 +43,7 @@ if [ -z "${MOODLE_CODENAME}" ]; then
fi

export MOODLE_CODENAME=${MOODLE_CODENAME}
export MOODLE_DOCKER_THEMEDEVEL=${MOODLE_DOCKER_THEMEDEVEL:-}

# Related to Moodle
if [ -z "${MOODLE_DB_TYPE}" ]; then
Expand Down
6 changes: 6 additions & 0 deletions bin/moodle-docker-compose
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ dockercompose="${dockercompose} -f ${basedir}/service.mail.yml"
# PHP Version.
export MOODLE_DOCKER_PHP_VERSION=${MOODLE_DOCKER_PHP_VERSION:-7.3}

# Enable Theme developement mode (specify the theme _name_ in that variable
if [ -n "$MOODLE_DOCKER_THEMEDEVEL" ];
then
dockercompose="${dockercompose} -f ${basedir}/themedevel.yml"
fi

# Enable Traefik
if [ -n "$MOODLE_DOCKER_TRAEFIK" ];
then
Expand Down
14 changes: 14 additions & 0 deletions config.docker-template.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,20 @@
$CFG->wwwroot .= ":{$port}";
}
}

$themedevel = getenv('MOODLE_DOCKER_THEMEDEVEL');
if (!empty($themedevel)) {
$CFG->theme = $themedevel;
$CFG->devel_custom_additional_head = '<link rel="stylesheet" type="text/css" href="/theme/' . $themedevel . '/build/stylesheets/compiled.css" />';

$webhost = getenv('MOODLE_DOCKER_BROWSERSYNC_WEBHOST');
if (!empty($webhost)) {
$CFG->browsersyncurl = 'https://'.$webhost;
$CFG->wwwroot = 'https://'.$webhost;
$CFG->reverseproxy = true;
}
}

$CFG->dataroot = '/var/www/moodledata';
$CFG->admin = 'admin';
$CFG->directorypermissions = 0777;
Expand Down
38 changes: 38 additions & 0 deletions themedevel.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
version: "2"
services:
themedevel:
image: "node:15" # node-sass doesn't support node 16 https://github.com/sass/node-sass/issues/3077
depends_on:
- webserver
volumes:
- "${MOODLE_DOCKER_WWWROOT}:/var/www/html"
- "/var/www/html/theme/${MOODLE_DOCKER_THEMEDEVEL}/node_modules"
- "themebuild:/var/www/html/theme/${MOODLE_DOCKER_THEMEDEVEL}/build"
working_dir: /var/www/html/theme/${MOODLE_DOCKER_THEMEDEVEL}
command: bash -c "npm install && npm run start"
ports:
- 3000
- 3001
environment:
- MOODLE_DOCKER_THEMEDEVEL=${MOODLE_DOCKER_THEMEDEVEL}
- MOODLE_DOCKER_BROWSERSYNC_WEBHOST=browsersync.${MOODLE_DOCKER_WEB_HOST}
- MOODLE_DOCKER_WEBSERVER_INTERNAL=webserver_for_themedevel
labels:
- "traefik.enable=true"
- "traefik.frontend.rule=Host:browsersync.${MOODLE_DOCKER_WEB_HOST}"
- 'traefik.docker.network=pontsun'
networks:
- default
- pontsun
webserver:
environment:
- MOODLE_DOCKER_THEMEDEVEL=${MOODLE_DOCKER_THEMEDEVEL}
- MOODLE_DOCKER_BROWSERSYNC_WEBHOST=browsersync.${MOODLE_DOCKER_WEB_HOST}
networks:
default:
aliases:
- webserver_for_themedevel
volumes:
- "themebuild:/var/www/html/theme/${MOODLE_DOCKER_THEMEDEVEL}/build"
volumes:
themebuild: