Skip to content

Commit fccc39f

Browse files
committed
Add docker-entrypoint-initdb
1 parent 4166928 commit fccc39f

File tree

2 files changed

+37
-4
lines changed

2 files changed

+37
-4
lines changed

Dockerfile

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ ARG DEBIAN_FRONTEND=noninteractive
66
ADD root/tmp/setup/php-extensions.sh /tmp/setup/
77
RUN chmod 777 /tmp && chmod +t /tmp && \
88
/tmp/setup/php-extensions.sh
9+
ADD nvm-wrapper /usr/local/bin/nvm
910

1011
# Install the PHP MSSQL Extension.
1112
ADD root/tmp/setup/mssql-extension.sh /tmp/setup/
@@ -18,7 +19,7 @@ ADD root/tmp/setup/oci8-extension.sh /tmp/setup/
1819
RUN chmod 777 /tmp && chmod +t /tmp && \
1920
/tmp/setup/oci8-extension.sh
2021

21-
RUN mkdir /var/www/moodledata && chown www-data /var/www/moodledata && \
22-
mkdir /var/www/phpunitdata && chown www-data /var/www/phpunitdata && \
23-
mkdir /var/www/behatdata && chown www-data /var/www/behatdata && \
24-
mkdir /var/www/behatfaildumps && chown www-data /var/www/behatfaildumps
22+
# Set the custom entrypoint.
23+
ADD moodle-php-entrypoint /usr/local/bin/
24+
ENTRYPOINT ["moodle-php-entrypoint"]
25+
CMD ["apache2-foreground"]

moodle-php-entrypoint

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
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:www-data /var/www/moodledata
8+
mkdir /var/www/phpunitdata && chown www-data:www-data /var/www/phpunitdata
9+
mkdir /var/www/behatdata && chown www-data:www-data /var/www/behatdata
10+
mkdir /var/www/behatfaildumps && chown www-data:www-data /var/www/behatfaildumps
11+
12+
# Load any additional entrypoint init files.
13+
for f in /docker-entrypoint-initdb.d/*; do
14+
case "$f" in
15+
*.sh)
16+
# https://github.com/docker-library/postgres/issues/450#issuecomment-393167936
17+
# https://github.com/docker-library/postgres/pull/452
18+
if [ -x "$f" ]; then
19+
echo "$0: running $f"
20+
"$f"
21+
else
22+
echo "$0: sourcing $f"
23+
. "$f"
24+
fi
25+
;;
26+
*) echo "$0: ignoring $f" ;;
27+
esac
28+
echo
29+
done
30+
31+
# Execute the original entrypoint with the original args.
32+
exec docker-php-entrypoint $ARGS

0 commit comments

Comments
 (0)