forked from TrafeX/docker-wordpress
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathentrypoint.sh
executable file
·30 lines (28 loc) · 938 Bytes
/
entrypoint.sh
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
#!/bin/bash
# terminate on errors
set -e
# Check if volume is empty
if [ ! "$(ls -A "/var/www/wp-content" 2>/dev/null)" ]; then
echo 'Setting up wp-content volume'
# Copy wp-content from Wordpress src to volume
cp -r /usr/src/wordpress/wp-content /var/www/
chown -R nobody.nobody /var/www
fi
# Check if wp-secrets.php exists
if ! [ -f "/var/www/wp-content/wp-secrets.php" ]; then
# Check that secrets environment variables are not set
if [ ! $AUTH_KEY ] \
&& [ ! $SECURE_AUTH_KEY ] \
&& [ ! $LOGGED_IN_KEY ] \
&& [ ! $NONCE_KEY ] \
&& [ ! $AUTH_SALT ] \
&& [ ! $SECURE_AUTH_SALT ] \
&& [ ! $LOGGED_IN_SALT ] \
&& [ ! $NONCE_SALT ]; then
echo "Generating wp-secrets.php"
# Generate secrets
echo '<?php' > /var/www/wp-content/wp-secrets.php
curl -f https://api.wordpress.org/secret-key/1.1/salt/ >> /var/www/wp-content/wp-secrets.php
fi
fi
exec "$@"