-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-entrypoint.sh
More file actions
executable file
·33 lines (26 loc) · 1.12 KB
/
docker-entrypoint.sh
File metadata and controls
executable file
·33 lines (26 loc) · 1.12 KB
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
#!/usr/bin/env bash
# Any background job should have it's messages printed.
set -m
# Don't continue if any command in the script fails.
set -e
# Delete any previously existing run file.
if [ -f /run/apache2/apache2.pid ]; then
rm /run/apache2/apache2.pid
fi
# Allow the Apache docroot to be overridden.
APACHE_DOCROOT_DIR="${APACHE_DOCROOT_DIR:-/var/www/web}"
if [ -n "$APACHE_DOCROOT_DIR" ]; then
sed -i 's@^\s*DocumentRoot.*@'" DocumentRoot ${APACHE_DOCROOT_DIR}"'@' /etc/apache2/sites-available/000-default.conf
fi
# Allow the site name to be overriden.
APACHE_SITE_NAME="${APACHE_SITE_NAME:-wvtc.net}"
if [ -n "$APACHE_SITE_NAME" ]; then
sed -i 's@^\s*ServerName.*@'" ServerName ${APACHE_SITE_NAME}"'@' /etc/apache2/sites-available/000-default.conf
fi
# Allow for site aliases to be provided.
APACHE_SITE_ALIAS="${APACHE_SITE_ALIAS:-docker.localhost}"
if [ -n "$APACHE_SITE_ALIAS" ]; then
sed -i 's@^\s*ServerAlias.*@'" ServerAlias ${APACHE_SITE_ALIAS}"'@' /etc/apache2/sites-available/000-default.conf
fi
# Now that we're set up, run whatever command was passed to the entrypoint.
exec "$@"