# ------------------------------------------------- # 1️⃣ Base image – official WordPress (PHP 8.2 + Apache) # ------------------------------------------------- FROM wordpress:php8.2-apache # ------------------------------------------------- # 2️⃣ Remove every bundled WordPress theme (bloat) # ------------------------------------------------- RUN rm -rf /usr/src/wordpress/wp-content/themes/* # ------------------------------------------------- # 3️⃣ PHP configuration (optional – increase limits) # ------------------------------------------------- COPY config/php.ini /usr/local/etc/php/conf.d/custom.ini # ------------------------------------------------- # 4️⃣ Install system utilities (unzip) and Composer # ------------------------------------------------- RUN apt-get update && \ apt-get install -y --no-install-recommends unzip && \ rm -rf /var/lib/apt/lists/* && \ curl -sS https://getcomposer.org/installer | \ php -- --install-dir=/usr/local/bin --filename=composer # ------------------------------------------------- # 5️⃣ Install WP‑CLI (handy for wp commands) # ------------------------------------------------- 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 # ------------------------------------------------- # 6️⃣ Install plugins via Composer # ------------------------------------------------- WORKDIR /var/www/html COPY composer.json composer.lock ./ RUN composer install --no-dev --optimize-autoloader && \ rm composer.json composer.lock # ------------------------------------------------- # 7️⃣ Copy your custom theme (already built) # ------------------------------------------------- # The folder `indy-wp/indywp/` should contain the final theme # structure, including a top‑level `style.css`. COPY indy-wp/indywp/ /var/www/html/wp-content/themes/indywp/ # ------------------------------------------------- # 8️⃣ Copy the theme’s media folder into the theme directory # ------------------------------------------------- COPY indy-wp/media/ /var/www/html/wp-content/themes/indywp/images/ # ------------------------------------------------- # 9️⃣ (Optional) copy any extra project files you need # ------------------------------------------------- COPY src/ /var/www/html/wp-content/mu-plugins/ # ------------------------------------------------- # 🔟 Ensure wp‑content is writable by www-data # ------------------------------------------------- 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 # ------------------------------------------------- # 🛡️ Healthcheck (optional) # ------------------------------------------------- HEALTHCHECK --interval=30s --timeout=5s \ CMD curl -f http://localhost/wp-admin/install.php || exit 1 # ------------------------------------------------- # 📣 Expose HTTP # ------------------------------------------------- EXPOSE 80 # ------------------------------------------------- # 🚀 Default command – Apache in foreground # ------------------------------------------------- CMD ["apache2-foreground"]