indy-wp/Dockerfile

79 lines
3.2 KiB
Docker
Raw Normal View History

# -------------------------------------------------
# 1⃣ Base image official WordPress (PHP8.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 WPCLI (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)
# -------------------------------------------------
COPY indy-wp/indywp/ /var/www/html/wp-content/themes/indywp/
# -------------------------------------------------
# 8⃣ Copy the themes media folder into the theme directory
# -------------------------------------------------
COPY indy-wp/media/ /var/www/html/wp-content/themes/indywp/images/
# -------------------------------------------------
2026-03-04 23:25:59 +00:00
# 9⃣ Copy any muplugins (mustuse) **default folder**
# -------------------------------------------------
2026-03-04 23:25:59 +00:00
# Anything placed in the local `mu-plugins/` directory will be
# loaded automatically by WordPress on every request.
2026-03-04 23:29:11 +00:00
#COPY mu-plugins/ /var/www/html/wp-content/mu-plugins/
# -------------------------------------------------
# 🔟 Ensure wpcontent 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"]