indy-wp/Dockerfile

83 lines
3.3 KiB
Docker
Raw Blame History

This file contains invisible Unicode characters!

This file contains invisible Unicode characters that may be processed differently from what appears below. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to reveal hidden characters.

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

FROM wordpress:php8.2-apache
# -------------------------------------------------
# 1⃣ Remove bundled themes (keep only core)
# -------------------------------------------------
RUN rm -rf /usr/src/wordpress/wp-content/themes/*
# -------------------------------------------------
# 2⃣ Custom PHP config
# -------------------------------------------------
COPY config/php.ini /usr/local/etc/php/conf.d/custom.ini
# -------------------------------------------------
# 3⃣ System utilities + 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
# -------------------------------------------------
# 4⃣ WPCLI
# -------------------------------------------------
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⃣ Copy WordPress core (triggered by official entrypoint later)
# -------------------------------------------------
WORKDIR /var/www/html
# -------------------------------------------------
# 6⃣ Theme archive → proper theme folder
# -------------------------------------------------
COPY indy-wp/indywp.zip /tmp/indywp.zip
RUN unzip /tmp/indywp.zip -d /tmp && \
mv /tmp/indywp /var/www/html/wp-content/themes/indywp && \
rm /tmp/indywp.zip && \
chown -R www-data:www-data /var/www/html/wp-content/themes/indywp && \
chmod -R 755 /var/www/html/wp-content/themes/indywp
# -------------------------------------------------
# 7⃣ Preset assets (optional)
# -------------------------------------------------
COPY theme-assets/indywp/assets/ /var/www/html/wp-content/themes/indywp/assets/
RUN chown -R www-data:www-data /var/www/html/wp-content/themes/indywp/assets && \
chmod -R 644 /var/www/html/wp-content/themes/indywp/assets
# -------------------------------------------------
# 8⃣ Writable uploads folder
# -------------------------------------------------
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⃣ Install plugins via Composer **after** core is present
# -------------------------------------------------
COPY composer.json composer.lock ./
RUN composer install --no-dev --optimize-autoloader && \
rm composer.json composer.lock && \
chown -R www-data:www-data /var/www/html/wp-content/plugins && \
chmod -R 755 /var/www/html/wp-content/plugins
# -------------------------------------------------
# 🔟 Healthcheck
# -------------------------------------------------
HEALTHCHECK --interval=30s --timeout=5s \
CMD curl -f http://localhost/wp-admin/install.php || exit 1
EXPOSE 80
# -------------------------------------------------
# 📜 Custom entrypoint (calls official one first)
# -------------------------------------------------
COPY entrypoint.sh /usr/local/bin/
RUN chmod +x /usr/local/bin/entrypoint.sh
ENTRYPOINT ["entrypoint.sh"]
CMD ["apache2-foreground"]