-
Notifications
You must be signed in to change notification settings - Fork 73
/
Copy pathmoodle-php-entrypoint
executable file
·41 lines (35 loc) · 1.36 KB
/
moodle-php-entrypoint
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/usr/bin/env bash
set -Eeo pipefail
ARGS="$@"
# Create directories for general usage.
mkdir /var/www/moodledata && chown www-data:www-data /var/www/moodledata
mkdir /var/www/phpunitdata && chown www-data:www-data /var/www/phpunitdata
mkdir /var/www/behatdata && chown www-data:www-data /var/www/behatdata
mkdir /var/www/behatfaildumps && chown www-data:www-data /var/www/behatfaildumps
# Ensure that all users get NVM as standard.
echo '[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"' >> /etc/bash.bashrc
echo 'export NODE_REPL_HISTORY=' >> /etc/bash.bashrc
mkdir /var/www/.config && chown www-data:www-data /var/www/.config
# Ensure that the requested version of node is installed.
source $NVM_DIR/nvm.sh && nvm install $NODE_VERSION && nvm use --delete-prefix $NODE_VERSION
echo 'nvm use "$NODE_VERSION"' >> /etc/bash.bashrc
# Load any additional entrypoint init files.
for f in /docker-entrypoint-initdb.d/*; do
case "$f" in
*.sh)
# https://github.com/docker-library/postgres/issues/450#issuecomment-393167936
# https://github.com/docker-library/postgres/pull/452
if [ -x "$f" ]; then
echo "$0: running $f"
"$f"
else
echo "$0: sourcing $f"
. "$f"
fi
;;
*) echo "$0: ignoring $f" ;;
esac
echo
done
# Execute the original entrypoint with the original args.
exec docker-php-entrypoint $ARGS