lafundicio-wordpress/entrypoint.sh

40 lines
1.2 KiB
Bash
Raw Normal View History

2022-02-26 20:43:43 +01:00
#!/bin/bash
set -e;
install() {
cd /app
wget --quiet https://wordpress.org/latest.tar.gz
tar -xzf latest.tar.gz
rm latest.tar.gz
}
config() {
2022-02-26 21:51:09 +01:00
if [ -n /app/wordpress/wp-config.php ]; then cp /tmp/wp-config-sample.php /app/wordpress/wp-config.php; fi
2022-02-26 20:43:43 +01:00
if [ -n $MYSQL_DATABASE ]; then sed -i "s:MYSQL_DATABASE:$MYSQL_DATABASE:" /app/wordpress/wp-config.php; fi
if [ -n $MYSQL_USER ]; then sed -i "s:MYSQL_USER:$MYSQL_USER:" /app/wordpress/wp-config.php; fi
if [ -n $MYSQL_PASSWORD ]; then sed -i "s:MYSQL_PASSWORD:$MYSQL_PASSWORD:" /app/wordpress/wp-config.php; fi
if [ -n $MYSQL_HOST ]; then sed -i "s:MYSQL_HOST:$MYSQL_HOST:" /app/wordpress/wp-config.php; fi
curl -s https://api.wordpress.org/secret-key/1.1/salt | tee -a /app/wordpress/wp-config.php
#SALT_KEYS=$(curl -s https://api.wordpress.org/secret-key/1.1/salt)
#echo $SALT_KEYS >> /app/wordpress/wp-config.php;
2022-02-26 20:43:43 +01:00
}
2022-02-26 21:51:09 +01:00
update() {
#https://make.wordpress.org/cli/handbook/
wp core update --path="/app/wordpress/"
wp plugin update --all --path="/app/wordpress/"
wp theme update --all --path="/app/wordpress/"
2022-02-26 20:43:43 +01:00
}
2022-02-26 21:51:09 +01:00
[ -d /app/wordpress ] || install
[ -f /app/wordpress/wp-config.php ] || config
#[ -d /app/wordpress ] && update
2022-02-26 20:43:43 +01:00
echo "Starting Wordpress"
exec $@