Skip to content

Commit 8256be5

Browse files
authored
Merge pull request #242 from andrewnicols/local_yml
Add support for local.yml
2 parents 954c7ce + 13b0fd2 commit 8256be5

File tree

4 files changed

+43
-0
lines changed

4 files changed

+43
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
local.yml

README.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,31 @@ When you change them, use `bin/moodle-docker-compose down && bin/moodle-docker-c
219219
| `MOODLE_DOCKER_APP_VERSION` | no | a valid [app docker image version](https://docs.moodle.org/dev/Moodle_App_Docker_images) | not set | If set will start an instance of the Moodle app if the chrome browser is selected |
220220
| `MOODLE_DOCKER_APP_RUNTIME` | no | 'ionic3' or 'ionic5' | not set | Set this to indicate the runtime being used in the Moodle app. In most cases, this can be ignored because the runtime is guessed automatically (except on Windows using the `.cmd` binary). In case you need to set it manually and you're not sure which one it is, versions 3.9.5 and later should be using Ionic 5. |
221221

222+
## Local customisations
223+
224+
In some situations you may wish to add local customisations, such as including additional containers, or changing existing containers.
225+
226+
This can be accomplished by specifying a `local.yml`, which will be added in and loaded with the existing yml configuration files automatically. For example:
227+
228+
``` file="local.yml"
229+
version: "2"
230+
services:
231+
232+
# Add the adminer image at the latest tag on port 8080:8080
233+
adminer:
234+
image: adminer:latest
235+
restart: always
236+
ports:
237+
- 8080:8080
238+
depends_on:
239+
- "db"
240+
241+
# Modify the webserver image to add another volume:
242+
webserver:
243+
volumes:
244+
- "/opt/data:/opt/data:cached"
245+
```
246+
222247
## Using XDebug for live debugging
223248

224249
The XDebug PHP Extension is not included in this setup and there are reasons not to include it by default.

bin/moodle-docker-compose

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,5 +201,13 @@ if [[ "$(uname)" == "Darwin" ]]; then
201201
dockercompose="${dockercompose} -f ${basedir}/volumes-cached.yml"
202202
fi
203203

204+
# Apply local customisations if a local.yml is found.
205+
# Note: This must be the final modification before the docker-compose command is called.
206+
localfile="${basedir}/local.yml"
207+
if [ -f "${localfile}" ]
208+
then
209+
echo "Including local options from ${localfile}"
210+
dockercompose="${dockercompose} -f ${localfile}"
211+
fi
204212

205213
$dockercompose "$@"

bin/moodle-docker-compose.cmd

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,4 +144,13 @@ IF "%MOODLE_DOCKER_SELENIUM_VNC_PORT%"=="" (
144144
)
145145
)
146146

147+
148+
REM Apply local customisations if a local.yml is found.
149+
REM Note: This must be the final modification before the docker-compose command is called.
150+
SET LOCALFILE=%BASEDIR%\local.yml
151+
IF EXIST %LOCALFILE% (
152+
ECHO Including local options from %localfile%
153+
SET DOCKERCOMPOSE=%DOCKERCOMPOSE% -f "%LOCALFILE%"
154+
)
155+
147156
%DOCKERCOMPOSE% %*

0 commit comments

Comments
 (0)