77 lines
3.1 KiB
Docker
77 lines
3.1 KiB
Docker
# -------------------------------------------------
|
||
# 0️⃣ Base image – official WordPress (PHP 8.2 + Apache)
|
||
# -------------------------------------------------
|
||
FROM wordpress:php8.2-apache
|
||
|
||
# -------------------------------------------------
|
||
# 1️⃣ Remove bundled themes (optional)
|
||
# -------------------------------------------------
|
||
RUN rm -rf /usr/src/wordpress/wp-content/themes/*
|
||
|
||
# -------------------------------------------------
|
||
# 2️⃣ PHP configuration (optional – increase limits)
|
||
# -------------------------------------------------
|
||
COPY config/php.ini /usr/local/etc/php/conf.d/custom.ini
|
||
|
||
# -------------------------------------------------
|
||
# 3️⃣ System utilities + mariadb client (for DB check)
|
||
# -------------------------------------------------
|
||
RUN apt-get update && \
|
||
apt-get install -y --no-install-recommends unzip mariadb-client && \
|
||
rm -rf /var/lib/apt/lists/* && \
|
||
curl -sS https://getcomposer.org/installer | \
|
||
php -- --install-dir=/usr/local/bin --filename=composer
|
||
|
||
# -------------------------------------------------
|
||
# 4️⃣ WP‑CLI (already used by your old entrypoint)
|
||
# -------------------------------------------------
|
||
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
|
||
|
||
# -------------------------------------------------
|
||
# 5️⃣ Composer‑based plugins
|
||
# -------------------------------------------------
|
||
WORKDIR /var/www/html
|
||
COPY composer.json composer.lock ./
|
||
RUN composer install --no-dev --optimize-autoloader && \
|
||
rm composer.json composer.lock
|
||
|
||
# -------------------------------------------------
|
||
# 6️⃣ Theme & media (your existing copies)
|
||
# -------------------------------------------------
|
||
COPY indy-wp/indywp/ /var/www/html/wp-content/themes/indywp/
|
||
COPY indy-wp/media/ /var/www/html/wp-content/uploads/2026/03/
|
||
|
||
# -------------------------------------------------
|
||
# 7️⃣ Export file – the XML you exported from WP
|
||
# -------------------------------------------------
|
||
COPY export/indymedia.WordPress.xml /tmp/site-export.xml
|
||
|
||
# -------------------------------------------------
|
||
# 8️⃣ Permissions for wp‑content
|
||
# -------------------------------------------------
|
||
RUN mkdir -p /var/www/html/wp-content/uploads && \
|
||
chown -R www-data:www-data /var/www/html/wp-content && \
|
||
chmod -R 775 /var/www/html/wp-content
|
||
|
||
# -------------------------------------------------
|
||
# 9️⃣ Custom entrypoint (wrapper)
|
||
# -------------------------------------------------
|
||
COPY entrypoint.sh /usr/local/bin/entrypoint.sh
|
||
RUN chmod +x /usr/local/bin/entrypoint.sh
|
||
|
||
# -------------------------------------------------
|
||
# 🔟 Healthcheck (optional)
|
||
# -------------------------------------------------
|
||
HEALTHCHECK --interval=30s --timeout=5s \
|
||
CMD curl -f http://localhost/wp-admin/install.php || exit 1
|
||
|
||
EXPOSE 80
|
||
|
||
# -------------------------------------------------
|
||
# 🚀 Use the wrapper, then the original entrypoint
|
||
# -------------------------------------------------
|
||
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
|
||
CMD ["apache2-foreground"]
|