File tree Expand file tree Collapse file tree 1 file changed +19
-6
lines changed
Expand file tree Collapse file tree 1 file changed +19
-6
lines changed Original file line number Diff line number Diff line change 11#! /bin/bash
2- set -e
2+ # Don't use set -e so script continues even if some commands fail
3+
4+ # Change to WordPress directory
5+ cd /var/www/html
6+
7+ # Wait for wp-config.php to exist (created by docker-entrypoint)
8+ echo " Waiting for WordPress configuration..."
9+ while [ ! -f /var/www/html/wp-config.php ]; do
10+ sleep 2
11+ done
312
413# Wait for database to be ready
5- until wp db check --allow-root 2> /dev/null; do
6- echo " Waiting for database..."
14+ echo " Waiting for database connection..."
15+ for i in $( seq 1 30) ; do
16+ if wp db check --allow-root --path=/var/www/html 2> /dev/null; then
17+ echo " Database connected!"
18+ break
19+ fi
20+ echo " Database not ready, attempt $i /30..."
721 sleep 3
822done
923
@@ -49,10 +63,9 @@ if ! wp plugin is-active next-revalidate --allow-root 2>/dev/null; then
4963 wp plugin activate next-revalidate --allow-root
5064fi
5165
52- # Activate the headless theme (always run, safe if already active)
53- # Note: Theme directory name must match the actual directory in wp-content/themes
66+ # Activate the headless theme
5467echo " Activating Next.js Headless theme..."
55- wp theme activate theme --allow-root || wp theme activate nextjs-headless --allow-root || true
68+ wp theme activate nextjs-headless --allow-root || echo " WARNING: Could not activate nextjs-headless theme "
5669
5770# Configure the plugin if NEXTJS_URL is set
5871if [ -n " $NEXTJS_URL " ]; then
You can’t perform that action at this time.
0 commit comments