2026-03-05 08:03:57 +00:00
|
|
|
|
FROM wordpress:php8.2-apache AS base
|
2026-03-04 22:45:28 +00:00
|
|
|
|
|
|
|
|
|
|
# -------------------------------------------------
|
2026-03-05 07:11:01 +00:00
|
|
|
|
# 1️⃣ Remove bundled themes (keep only core)
|
2026-03-04 22:45:28 +00:00
|
|
|
|
# -------------------------------------------------
|
|
|
|
|
|
RUN rm -rf /usr/src/wordpress/wp-content/themes/*
|
|
|
|
|
|
|
|
|
|
|
|
# -------------------------------------------------
|
2026-03-05 07:11:01 +00:00
|
|
|
|
# 2️⃣ Custom PHP config
|
2026-03-04 22:45:28 +00:00
|
|
|
|
# -------------------------------------------------
|
|
|
|
|
|
COPY config/php.ini /usr/local/etc/php/conf.d/custom.ini
|
|
|
|
|
|
|
|
|
|
|
|
# -------------------------------------------------
|
2026-03-05 07:11:01 +00:00
|
|
|
|
# 3️⃣ System utilities + Composer
|
2026-03-04 22:45:28 +00:00
|
|
|
|
# -------------------------------------------------
|
|
|
|
|
|
RUN apt-get update && \
|
2026-03-05 07:11:01 +00:00
|
|
|
|
apt-get install -y --no-install-recommends unzip && \
|
2026-03-04 22:45:28 +00:00
|
|
|
|
rm -rf /var/lib/apt/lists/* && \
|
|
|
|
|
|
curl -sS https://getcomposer.org/installer | \
|
|
|
|
|
|
php -- --install-dir=/usr/local/bin --filename=composer
|
|
|
|
|
|
|
|
|
|
|
|
# -------------------------------------------------
|
2026-03-05 07:11:01 +00:00
|
|
|
|
# 4️⃣ WP‑CLI
|
2026-03-04 22:45:28 +00:00
|
|
|
|
# -------------------------------------------------
|
|
|
|
|
|
RUN curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar && \
|
|
|
|
|
|
chmod +x wp-cli.phar && \
|
|
|
|
|
|
mv wp-cli.phar /usr/local/bin/wp
|
|
|
|
|
|
|
|
|
|
|
|
WORKDIR /var/www/html
|
|
|
|
|
|
|
|
|
|
|
|
# -------------------------------------------------
|
2026-03-05 09:45:20 +00:00
|
|
|
|
# Give www-data ownership of WP‑CLI cache folder
|
2026-03-04 22:45:28 +00:00
|
|
|
|
# -------------------------------------------------
|
2026-03-05 09:45:20 +00:00
|
|
|
|
RUN mkdir -p /var/www/.wp-cli && chown -R www-data:www-data /var/www/.wp-cli
|
2026-03-04 22:45:28 +00:00
|
|
|
|
|
|
|
|
|
|
# -------------------------------------------------
|
2026-03-05 09:45:20 +00:00
|
|
|
|
# 5️⃣ (Removed) theme‑install step that caused the error
|
2026-03-04 22:45:28 +00:00
|
|
|
|
# -------------------------------------------------
|
|
|
|
|
|
|
|
|
|
|
|
# -------------------------------------------------
|
2026-03-05 09:45:20 +00:00
|
|
|
|
# 6️⃣ Writable uploads folder
|
2026-03-05 08:03:57 +00:00
|
|
|
|
# -------------------------------------------------
|
2026-03-05 09:45:20 +00:00
|
|
|
|
RUN mkdir -p wp-content/uploads && \
|
|
|
|
|
|
chown -R www-data:www-data wp-content && \
|
|
|
|
|
|
chmod -R 775 wp-content
|
2026-03-05 08:03:57 +00:00
|
|
|
|
|
|
|
|
|
|
# -------------------------------------------------
|
2026-03-05 09:45:20 +00:00
|
|
|
|
# 7️⃣ Composer‑based plugins (same as before)
|
2026-03-04 22:45:28 +00:00
|
|
|
|
# -------------------------------------------------
|
2026-03-05 07:11:01 +00:00
|
|
|
|
COPY composer.json composer.lock ./
|
|
|
|
|
|
RUN composer install --no-dev --optimize-autoloader && \
|
|
|
|
|
|
rm composer.json composer.lock && \
|
2026-03-05 09:45:20 +00:00
|
|
|
|
chown -R www-data:www-data wp-content/plugins && \
|
|
|
|
|
|
chmod -R 755 wp-content/plugins
|
2026-03-04 22:45:28 +00:00
|
|
|
|
|
|
|
|
|
|
# -------------------------------------------------
|
2026-03-05 09:45:20 +00:00
|
|
|
|
# 8️⃣ Healthcheck
|
2026-03-04 22:45:28 +00:00
|
|
|
|
# -------------------------------------------------
|
2026-03-05 00:12:31 +00:00
|
|
|
|
HEALTHCHECK --interval=30s --timeout=5s \
|
|
|
|
|
|
CMD curl -f http://localhost/wp-admin/install.php || exit 1
|
|
|
|
|
|
|
2026-03-04 22:45:28 +00:00
|
|
|
|
EXPOSE 80
|
|
|
|
|
|
|
|
|
|
|
|
# -------------------------------------------------
|
2026-03-05 07:11:01 +00:00
|
|
|
|
# 📜 Custom entrypoint (calls official one first)
|
2026-03-04 22:45:28 +00:00
|
|
|
|
# -------------------------------------------------
|
2026-03-05 07:11:01 +00:00
|
|
|
|
COPY entrypoint.sh /usr/local/bin/
|
|
|
|
|
|
RUN chmod +x /usr/local/bin/entrypoint.sh
|
|
|
|
|
|
|
2026-03-05 09:45:20 +00:00
|
|
|
|
COPY entrypoint-theme.sh /usr/local/bin/
|
|
|
|
|
|
RUN chmod +x /usr/local/bin/entrypoint-theme.sh
|
|
|
|
|
|
|
2026-03-05 07:11:01 +00:00
|
|
|
|
ENTRYPOINT ["entrypoint.sh"]
|
2026-03-04 22:45:28 +00:00
|
|
|
|
CMD ["apache2-foreground"]
|