Update Dockerfile, compose file and entrypoints after cleanup

main
radioparalelo 2026-03-09 19:56:56 +00:00
parent 9fa407c10c
commit 9f8f5e73eb
4 changed files with 14 additions and 58 deletions

View File

@ -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

View File

@ -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

View File

@ -2,7 +2,7 @@
set -e set -e
# ------------------------------------------------- # -------------------------------------------------
# Wait until WordPress core (wpconfig.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 IndyWP theme archive..." echo "🚀 Downloading IndyWP 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 (Dockers default entrypoint) # Hand over to the official entrypoint (starts Apache)
# ------------------------------------------------- # -------------------------------------------------
exec docker-entrypoint.sh apache2-foreground exec /usr/local/bin/docker-entrypoint.sh "$@"

View File

@ -2,12 +2,12 @@
set -eu set -eu
# ------------------------------------------------- # -------------------------------------------------
# 0 Run the official WordPress entrypoint first # 0Run the official WordPress entrypoint first
# ------------------------------------------------- # -------------------------------------------------
docker-entrypoint.sh "$@" docker-entrypoint.sh "$@"
# ------------------------------------------------- # -------------------------------------------------
# 1 Verify core exists # 1Verify 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 # 2wp-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 themeinstaller (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 "$@"