add: improved workflow for caprover

This commit is contained in:
2026-03-21 10:44:21 -03:00
parent 1b14051640
commit 9a723b069d
7 changed files with 91 additions and 15 deletions
@@ -1,8 +1,4 @@
# Instals msmtp if a SMTP_HOST var was configured
if test -n "${SMTP_HOST}"; then
apk add --no-cache msmtp;
if test -z "${SMTP_PORT:-}"; then
if test "${SMTP_TLS:-on}" = "off"; then
SMTP_PORT=25;
@@ -2,8 +2,6 @@
set -e
REQUIRED_VARS="WORDPRESS_SITEURL WORDPRESS_BLOGNAME WORDPRESS_ADMIN_USER WORDPRESS_ADMIN_EMAIL";
DEFAULT_THEME="twentytwentyfive"
for varname in ${REQUIRED_VARS}; do
value="$(export -p | grep $varname | cut -d '=' -f 2 | xargs)"
@@ -12,7 +10,7 @@ for varname in ${REQUIRED_VARS}; do
fi
done;
pwd
GET_LOCK=$(wp db query "SELECT GET_LOCK('wp_install_lock', 10);" --silent --skip-column-names)
if which wp && ! wp core is-installed; then
echo "Installing WordPress via WP-CLI..."
@@ -25,5 +23,5 @@ if which wp && ! wp core is-installed; then
fi
if test "$(wp theme list --format=count)" = "0"; then
wp theme install twentytwentyfive --force --activate;
wp theme install ${WORDPRESS_DEFAULT_THEME:-twentytwentysix} --force --activate;
fi
+34
View File
@@ -0,0 +1,34 @@
#!/bin/sh
set -e
echo "=== RUNTIME SETUP (start) ==="
if [ -n "${SMTP_HOST}" ]; then
echo "Configurando msmtp para ${SMTP_HOST}..."
cat > /etc/msmtprc <<EOF
defaults
auth ${SMTP_AUTH:-on}
tls ${SMTP_TLS:-on}
syslog on
account default
host ${SMTP_HOST}
port ${SMTP_PORT:-587}
from ${SMTP_FROM:-${WORDPRESS_ADMIN_EMAIL}}
user ${SMTP_USER}
password ${SMTP_PASSWORD}
EOF
chmod 600 /etc/msmtprc
# Aponta o PHP para o msmtp
printf 'sendmail_path = "/usr/bin/msmtp -t"\nmail.add_x_header = On' > /usr/local/etc/php/conf.d/99-mail.ini
else
echo "Nenhum SMTP_HOST detectado. Usando solução padrão do PHP."
rm -f /usr/local/etc/php/conf.d/99-mail.ini
fi
echo "=== RUNTIME SETUP (end) ==="
# O "pulo do gato": executa o entrypoint original da imagem do WordPress
# passando todos os argumentos (geralmente 'php-fpm')
exec docker-entrypoint.sh "$@"