-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathentrypoint.sh
More file actions
37 lines (30 loc) · 950 Bytes
/
entrypoint.sh
File metadata and controls
37 lines (30 loc) · 950 Bytes
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
#!/bin/bash
# mute CMD from official wordpress image entrypoint.
sed -i -e 's/^exec "$@"/#exec "$@"/g' /usr/local/bin/docker-entrypoint.sh
# Run the docker-entrypoint of official wordpress image to do the installation.
bash /usr/local/bin/docker-entrypoint.sh $1
# Update hostname and restart mail tools.
echo "127.0.0.1 $(hostname) localhost localhost.localdomain" >> /etc/hosts
postconf "smtputf8_enable = no"
postfix start
# Wait until the WordPress has been installed.
until wp core version --allow-root; do
sleep 5;
done;
# Replace the wp-config with our custom extra php.
wp core config \
--force \
--allow-root \
--skip-check \
--dbname=${WORDPRESS_DB_NAME} \
--dbuser=root \
--dbpass=${WORDPRESS_DB_PASSWORD} \
--dbhost=${WORDPRESS_DB_HOST} \
--extra-php <<PHP
require_once('/var/www/config/wp-config.php');
PHP
# Fix permissions
usermod -u $USER_ID -o www-data
chown -R www-data /var/www/html
# execute CMD
exec "$@"