Files
wc-bootstrap/docker/setup.sh
magdev 624de0cae6 Add Docker development environment
Multistage Dockerfile (WooCommerce download, wp-bootstrap npm build,
Composer deps, WordPress runtime), Compose stack with MariaDB, and
auto-setup entrypoint that installs WordPress and activates the theme
on first boot.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-28 11:59:20 +01:00

48 lines
1.3 KiB
Bash

#!/bin/bash
#
# First-run setup: installs WordPress, activates WooCommerce and wc-bootstrap.
#
# Usage:
# docker compose exec wordpress setup.sh
#
set -euo pipefail
WP_URL="${WP_URL:-http://localhost:8080}"
WP_TITLE="${WP_TITLE:-WC Bootstrap Dev}"
WP_ADMIN_USER="${WP_ADMIN_USER:-admin}"
WP_ADMIN_PASSWORD="${WP_ADMIN_PASSWORD:-admin}"
WP_ADMIN_EMAIL="${WP_ADMIN_EMAIL:-admin@example.com}"
cd /var/www/html
# Wait for WordPress files (entrypoint copies them on first boot)
until [ -f wp-config.php ]; do
echo "Waiting for WordPress to initialize..."
sleep 2
done
if ! wp core is-installed --allow-root 2>/dev/null; then
echo "Installing WordPress..."
wp core install \
--url="$WP_URL" \
--title="$WP_TITLE" \
--admin_user="$WP_ADMIN_USER" \
--admin_password="$WP_ADMIN_PASSWORD" \
--admin_email="$WP_ADMIN_EMAIL" \
--skip-email \
--allow-root
fi
echo "Activating WooCommerce..."
wp plugin activate woocommerce --allow-root 2>/dev/null || true
echo "Activating wc-bootstrap theme..."
wp theme activate wc-bootstrap --allow-root 2>/dev/null || true
echo ""
echo "Setup complete!"
echo " URL: $WP_URL"
echo " Admin: $WP_URL/wp-admin/"
echo " User: $WP_ADMIN_USER"
echo " Password: $WP_ADMIN_PASSWORD"