File tree Expand file tree Collapse file tree 3 files changed +19
-8
lines changed Expand file tree Collapse file tree 3 files changed +19
-8
lines changed Original file line number Diff line number Diff line change @@ -75,9 +75,8 @@ RUN curl -o /usr/local/bin/wp https://raw.githubusercontent.com/wp-cli/builds/gh
7575COPY wp-config.php /usr/src/wordpress
7676RUN chown nobody.nobody /usr/src/wordpress/wp-config.php && chmod 640 /usr/src/wordpress/wp-config.php
7777
78- # Append WP secrets
79- COPY wp-secrets.php /usr/src/wordpress
80- RUN chown nobody.nobody /usr/src/wordpress/wp-secrets.php && chmod 640 /usr/src/wordpress/wp-secrets.php
78+ # Link wp-secrets to location on wp-content
79+ RUN ln -s /var/www/wp-content/wp-secrets.php /usr/src/wordpress/wp-secrets.php
8180
8281# Entrypoint to copy wp-content
8382COPY entrypoint.sh /entrypoint.sh
Original file line number Diff line number Diff line change @@ -9,8 +9,22 @@ if [ ! "$(ls -A "/var/www/wp-content" 2>/dev/null)" ]; then
99 # Copy wp-content from Wordpress src to volume
1010 cp -r /usr/src/wordpress/wp-content /var/www/
1111 chown -R nobody.nobody /var/www
12-
13- # Generate secrets
14- curl -f https://api.wordpress.org/secret-key/1.1/salt/ >> /usr/src/wordpress/wp-secrets.php
12+ fi
13+ # Check if wp-secrets.php exists
14+ if ! [ -f " /var/www/wp-content/wp-secrets.php" ]; then
15+ # Check that secrets environment variables are not set
16+ if [ ! $AUTH_KEY ] \
17+ && [ ! $SECURE_AUTH_KEY ] \
18+ && [ ! $LOGGED_IN_KEY ] \
19+ && [ ! $NONCE_KEY ] \
20+ && [ ! $AUTH_SALT ] \
21+ && [ ! $SECURE_AUTH_SALT ] \
22+ && [ ! $LOGGED_IN_SALT ] \
23+ && [ ! $NONCE_SALT ]; then
24+ echo " Generating wp-secrets.php"
25+ # Generate secrets
26+ echo ' <?php' > /var/www/wp-content/wp-secrets.php
27+ curl -f https://api.wordpress.org/secret-key/1.1/salt/ >> /var/www/wp-content/wp-secrets.php
28+ fi
1529fi
1630exec " $@ "
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments