Update Dockerfile, compose file and entrypoints after cleanup
parent
9fa407c10c
commit
9f8f5e73eb
|
|
@ -57,7 +57,7 @@ RUN composer install --no-dev --optimize-autoloader && \
|
||||||
# 8️⃣ Healthcheck
|
# 8️⃣ Healthcheck
|
||||||
# -------------------------------------------------
|
# -------------------------------------------------
|
||||||
HEALTHCHECK --interval=30s --timeout=5s \
|
HEALTHCHECK --interval=30s --timeout=5s \
|
||||||
CMD curl -f http://localhost/wp-admin/install.php || exit 1
|
CMD curl -f http://localhost/wp-admin/ || exit 1
|
||||||
|
|
||||||
EXPOSE 80
|
EXPOSE 80
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ services:
|
||||||
- ./wp-data/uploads:/var/www/html/wp-content/uploads
|
- ./wp-data/uploads:/var/www/html/wp-content/uploads
|
||||||
- ./config/php.ini:/usr/local/etc/php/conf.d/custom.ini:ro
|
- ./config/php.ini:/usr/local/etc/php/conf.d/custom.ini:ro
|
||||||
- ./theme/images:/var/www/html/wp-content/uploads/theme-images:ro
|
- ./theme/images:/var/www/html/wp-content/uploads/theme-images:ro
|
||||||
entrypoint: ["/usr/local/bin/entrypoint-theme.sh"]
|
# entrypoint: ["/usr/local/bin/entrypoint-theme.sh"]
|
||||||
db:
|
db:
|
||||||
image: mariadb:10.11
|
image: mariadb:10.11
|
||||||
container_name: imc_db
|
container_name: imc_db
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
# -------------------------------------------------
|
# -------------------------------------------------
|
||||||
# Wait until WordPress core (wp‑config.php) exists
|
# Wait until WordPress core (wp-config.php) exists
|
||||||
# -------------------------------------------------
|
# -------------------------------------------------
|
||||||
while [ ! -f /var/www/html/wp-config.php ]; do
|
while [ ! -f /var/www/html/wp-config.php ]; do
|
||||||
echo "⏳ Waiting for WordPress core to be ready..."
|
echo "⏳ Waiting for WordPress core to be ready..."
|
||||||
|
|
@ -10,30 +10,22 @@ while [ ! -f /var/www/html/wp-config.php ]; do
|
||||||
done
|
done
|
||||||
|
|
||||||
# -------------------------------------------------
|
# -------------------------------------------------
|
||||||
# Theme source – Codeberg archive (bare repo)
|
# Download & install the custom theme
|
||||||
# -------------------------------------------------
|
# -------------------------------------------------
|
||||||
THEME_ZIP="https://codeberg.org/radioparalelo/indy-wp-theme/archive/main.zip"
|
THEME_ZIP="https://codeberg.org/radioparalelo/indy-wp-theme/archive/main.zip"
|
||||||
TMP_DIR=$(mktemp -d)
|
TMP_DIR=$(mktemp -d)
|
||||||
|
|
||||||
# -------------------------------------------------
|
|
||||||
# Download + unzip → ensure the folder is named `indywp`
|
|
||||||
# -------------------------------------------------
|
|
||||||
echo "🚀 Downloading Indy‑WP theme archive..."
|
echo "🚀 Downloading Indy‑WP theme archive..."
|
||||||
curl -L "$THEME_ZIP" -o "$TMP_DIR/main.zip"
|
curl -L "$THEME_ZIP" -o "$TMP_DIR/main.zip"
|
||||||
|
|
||||||
echo "🔧 Extracting archive..."
|
echo "🔧 Extracting archive..."
|
||||||
unzip -q "$TMP_DIR/main.zip" -d "$TMP_DIR"
|
unzip -q "$TMP_DIR/main.zip" -d "$TMP_DIR"
|
||||||
|
|
||||||
# The extracted folder will be something like `indy-wp-theme-main/`
|
|
||||||
EXTRACTED=$(find "$TMP_DIR" -maxdepth 1 -type d -name "indy-wp-theme*" | head -n1)
|
EXTRACTED=$(find "$TMP_DIR" -maxdepth 1 -type d -name "indy-wp-theme*" | head -n1)
|
||||||
|
|
||||||
# Move/rename it to the slug WordPress expects (`indywp`)
|
|
||||||
TARGET="/var/www/html/wp-content/themes/indywp"
|
TARGET="/var/www/html/wp-content/themes/indywp"
|
||||||
echo "📁 Installing theme to $TARGET ..."
|
|
||||||
rm -rf "$TARGET" # remove any previous copy
|
|
||||||
mv "$EXTRACTED" "$TARGET"
|
|
||||||
|
|
||||||
# Clean up temporary files
|
rm -rf "$TARGET"
|
||||||
|
mv "$EXTRACTED" "$TARGET"
|
||||||
rm -rf "$TMP_DIR"
|
rm -rf "$TMP_DIR"
|
||||||
|
|
||||||
# -------------------------------------------------
|
# -------------------------------------------------
|
||||||
|
|
@ -46,6 +38,6 @@ su www-data -s /bin/bash -c "\
|
||||||
"
|
"
|
||||||
|
|
||||||
# -------------------------------------------------
|
# -------------------------------------------------
|
||||||
# Start Apache (Docker’s default entrypoint)
|
# Hand over to the official entrypoint (starts Apache)
|
||||||
# -------------------------------------------------
|
# -------------------------------------------------
|
||||||
exec docker-entrypoint.sh apache2-foreground
|
exec /usr/local/bin/docker-entrypoint.sh "$@"
|
||||||
|
|
|
||||||
|
|
@ -2,12 +2,12 @@
|
||||||
set -eu
|
set -eu
|
||||||
|
|
||||||
# -------------------------------------------------
|
# -------------------------------------------------
|
||||||
# 0️⃣ Run the official WordPress entrypoint first
|
# 0️⃣ Run the official WordPress entrypoint first
|
||||||
# -------------------------------------------------
|
# -------------------------------------------------
|
||||||
docker-entrypoint.sh "$@"
|
docker-entrypoint.sh "$@"
|
||||||
|
|
||||||
# -------------------------------------------------
|
# -------------------------------------------------
|
||||||
# 1️⃣ Verify core exists
|
# 1️⃣ Verify core exists (optional safety net)
|
||||||
# -------------------------------------------------
|
# -------------------------------------------------
|
||||||
if [ ! -d /var/www/html/wp-admin ]; then
|
if [ ! -d /var/www/html/wp-admin ]; then
|
||||||
echo "❌ WordPress core missing after docker-entrypoint.sh"
|
echo "❌ WordPress core missing after docker-entrypoint.sh"
|
||||||
|
|
@ -15,24 +15,12 @@ if [ ! -d /var/www/html/wp-admin ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# -------------------------------------------------
|
# -------------------------------------------------
|
||||||
# 2️⃣ wp-config.php
|
# 2️⃣ wp-config.php (already created by the official entrypoint)
|
||||||
# -------------------------------------------------
|
# -------------------------------------------------
|
||||||
if [ ! -f /var/www/html/wp-config.php ]; then
|
# No need to create it here – the official entrypoint does it.
|
||||||
echo "⚙️ Creating wp-config.php..."
|
|
||||||
wp config create \
|
|
||||||
--dbname="${WORDPRESS_DB_NAME}" \
|
|
||||||
--dbuser="${WORDPRESS_DB_USER}" \
|
|
||||||
--dbpass="${WORDPRESS_DB_PASSWORD}" \
|
|
||||||
--dbhost="${WORDPRESS_DB_HOST}" \
|
|
||||||
--path=/var/www/html \
|
|
||||||
--allow-root
|
|
||||||
fi
|
|
||||||
|
|
||||||
sed -i '/^?>/d' /var/www/html/wp-config.php
|
|
||||||
echo "define('FS_METHOD','direct');" >> /var/www/html/wp-config.php
|
|
||||||
|
|
||||||
# -------------------------------------------------
|
# -------------------------------------------------
|
||||||
# 3️⃣ Wait for DB to be ready
|
# 3️⃣ Wait for DB to be ready (optional, the official entrypoint also does this)
|
||||||
# -------------------------------------------------
|
# -------------------------------------------------
|
||||||
until wp db check --path=/var/www/html --allow-root > /dev/null 2>&1; do
|
until wp db check --path=/var/www/html --allow-root > /dev/null 2>&1; do
|
||||||
echo "⏳ Waiting for database..."
|
echo "⏳ Waiting for database..."
|
||||||
|
|
@ -40,30 +28,6 @@ until wp db check --path=/var/www/html --allow-root > /dev/null 2>&1; do
|
||||||
done
|
done
|
||||||
|
|
||||||
# -------------------------------------------------
|
# -------------------------------------------------
|
||||||
# 4️⃣ Install core if not already installed
|
# 4️⃣ Hand over to the theme‑installer (entrypoint-theme.sh will be called later)
|
||||||
# -------------------------------------------------
|
|
||||||
if ! wp core is-installed --path=/var/www/html --allow-root; then
|
|
||||||
echo "🚀 Installing WordPress core..."
|
|
||||||
wp core install \
|
|
||||||
--url="http://localhost" \
|
|
||||||
--title="IndyMedia" \
|
|
||||||
--admin_user=admin \
|
|
||||||
--admin_password=admin123 \
|
|
||||||
--admin_email=admin@example.com \
|
|
||||||
--skip-email \
|
|
||||||
--allow-root
|
|
||||||
fi
|
|
||||||
|
|
||||||
# -------------------------------------------------
|
|
||||||
# 5️⃣ Activate our custom theme (force)
|
|
||||||
# -------------------------------------------------
|
|
||||||
if wp theme is-installed indywp --allow-root; then
|
|
||||||
wp theme activate indywp --allow-root
|
|
||||||
else
|
|
||||||
echo "⚠️ indywp theme not found – check Dockerfile copy step."
|
|
||||||
fi
|
|
||||||
|
|
||||||
# -------------------------------------------------
|
|
||||||
# 6️⃣ Hand over to the official entrypoint (starts Apache)
|
|
||||||
# -------------------------------------------------
|
# -------------------------------------------------
|
||||||
exec /usr/local/bin/docker-entrypoint.sh "$@"
|
exec /usr/local/bin/docker-entrypoint.sh "$@"
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue