Skip to content

Commit cb0ea62

Browse files
committed
Add docker-entrypoint-initdb
1 parent fef8ffb commit cb0ea62

File tree

2 files changed

+38
-4
lines changed

2 files changed

+38
-4
lines changed

Dockerfile

+3-4
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ ADD root/tmp/setup/oci8-extension.sh /tmp/setup/
2525
RUN chmod 777 /tmp && chmod +t /tmp && \
2626
/tmp/setup/oci8-extension.sh
2727

28-
RUN mkdir /var/www/moodledata && chown www-data /var/www/moodledata && \
29-
mkdir /var/www/phpunitdata && chown www-data /var/www/phpunitdata && \
30-
mkdir /var/www/behatdata && chown www-data /var/www/behatdata && \
31-
mkdir /var/www/behatfaildumps && chown www-data /var/www/behatfaildumps
28+
# Set the custom entrypoint up.
29+
COPY moodle-php-entrypoint /usr/local/bin/
30+
ENTRYPOINT ["moodle-php-entrypoint"]

moodle-php-entrypoint

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#!/usr/bin/env bash
2+
set -Eeo pipefail
3+
4+
ARGS="$@"
5+
6+
# Create directories for general usage.
7+
mkdir /var/www/moodledata && chown www-data /var/www/moodledata
8+
mkdir /var/www/phpunitdata && chown www-data /var/www/phpunitdata
9+
mkdir /var/www/behatdata && chown www-data /var/www/behatdata
10+
mkdir /var/www/behatfaildumps && chown www-data /var/www/behatfaildumps
11+
12+
# Ensure that the requested version of node is installed.
13+
source $NVM_DIR/nvm.sh && nvm install $NODE_VERSION && nvm use --delete-prefix $NODE_VERSION
14+
15+
# Load any entrypoint init.
16+
for f in /docker-entrypoint-initdb.d/*; do
17+
case "$f" in
18+
*.sh)
19+
# https://github.com/docker-library/postgres/issues/450#issuecomment-393167936
20+
# https://github.com/docker-library/postgres/pull/452
21+
if [ -x "$f" ]; then
22+
echo "$0: running $f"
23+
"$f"
24+
else
25+
echo "$0: sourcing $f"
26+
. "$f"
27+
fi
28+
;;
29+
*) echo "$0: ignoring $f" ;;
30+
esac
31+
echo
32+
done
33+
34+
# Execute the original entrypoint with the original args.
35+
exec docker-php-entrypoint $ARGS

0 commit comments

Comments
 (0)