2026-03-04 22:45:28 +00:00
|
|
|
|
# -------------------------------------------------
|
2026-03-10 22:07:14 +00:00
|
|
|
|
# Stage 1 – build Composer‑based plugins
|
2026-03-04 22:45:28 +00:00
|
|
|
|
# -------------------------------------------------
|
2026-03-10 22:07:14 +00:00
|
|
|
|
FROM php:8.2-cli AS builder
|
|
|
|
|
|
|
|
|
|
|
|
RUN apt-get update && \
|
|
|
|
|
|
apt-get install -y --no-install-recommends unzip git && \
|
|
|
|
|
|
rm -rf /var/lib/apt/lists/*
|
|
|
|
|
|
|
|
|
|
|
|
WORKDIR /app
|
|
|
|
|
|
COPY composer.json composer.lock ./
|
|
|
|
|
|
RUN curl -sS https://getcomposer.org/installer | php && \
|
|
|
|
|
|
php composer.phar install --no-dev --optimize-autoloader && \
|
|
|
|
|
|
rm -f composer.json composer.lock
|
2026-03-04 22:45:28 +00:00
|
|
|
|
|
|
|
|
|
|
# -------------------------------------------------
|
2026-03-10 22:07:14 +00:00
|
|
|
|
# Stage 2 – prepare the Indy WP theme (tar.gz version)
|
2026-03-04 22:45:28 +00:00
|
|
|
|
# -------------------------------------------------
|
2026-03-10 22:07:14 +00:00
|
|
|
|
FROM php:8.2-apache AS theme-preparer
|
|
|
|
|
|
|
|
|
|
|
|
RUN apt-get update && \
|
|
|
|
|
|
apt-get install -y --no-install-recommends wget tar && \
|
|
|
|
|
|
rm -rf /var/lib/apt/lists/*
|
|
|
|
|
|
|
|
|
|
|
|
ARG THEME_TAG=v1.0.0
|
|
|
|
|
|
# expose the tag to the runtime (used by the entrypoint)
|
|
|
|
|
|
ENV THEME_TAG=${THEME_TAG}
|
|
|
|
|
|
|
|
|
|
|
|
ARG TAR_URL=https://codeberg.org/radioparalelo/indy-wp-theme/archive/${THEME_TAG}.tar.gz
|
|
|
|
|
|
|
|
|
|
|
|
RUN wget -O /tmp/indy-wp-theme.tar.gz "${TAR_URL}" && \
|
|
|
|
|
|
tar -xzf /tmp/indy-wp-theme.tar.gz -C /tmp && \
|
|
|
|
|
|
rm /tmp/indy-wp-theme.tar.gz
|
2026-03-04 22:45:28 +00:00
|
|
|
|
|
|
|
|
|
|
# -------------------------------------------------
|
2026-03-10 22:07:14 +00:00
|
|
|
|
# Stage 3 – final WordPress image
|
2026-03-04 22:45:28 +00:00
|
|
|
|
# -------------------------------------------------
|
2026-03-10 22:07:14 +00:00
|
|
|
|
FROM wordpress:php8.2-apache
|
|
|
|
|
|
|
|
|
|
|
|
# ---- Custom PHP config -------------------------------------------------
|
|
|
|
|
|
COPY config/php.ini /usr/local/etc/php/conf.d/custom.ini
|
|
|
|
|
|
|
|
|
|
|
|
# ---- Install unzip & WP‑CLI --------------------------------------------
|
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/* && \
|
2026-03-10 22:07:14 +00:00
|
|
|
|
curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar && \
|
2026-03-04 22:45:28 +00:00
|
|
|
|
chmod +x wp-cli.phar && \
|
|
|
|
|
|
mv wp-cli.phar /usr/local/bin/wp
|
|
|
|
|
|
|
|
|
|
|
|
WORKDIR /var/www/html
|
|
|
|
|
|
|
2026-03-10 22:07:14 +00:00
|
|
|
|
# ---- WP‑CLI cache folder ------------------------------------------------
|
|
|
|
|
|
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-10 22:07:14 +00:00
|
|
|
|
# ---- Copy plugins from builder -----------------------------------------
|
|
|
|
|
|
COPY --from=builder \
|
|
|
|
|
|
--chown=www-data:www-data \
|
|
|
|
|
|
/app/wp-content/plugins /var/www/html/wp-content/plugins
|
2026-03-04 22:45:28 +00:00
|
|
|
|
|
2026-03-10 22:07:14 +00:00
|
|
|
|
# ---- Copy the theme ------------------------------------------------------
|
|
|
|
|
|
COPY --from=theme-preparer \
|
|
|
|
|
|
--chown=www-data:www-data \
|
|
|
|
|
|
/tmp/indy-wp-theme* /var/www/html/wp-content/themes/indy-wp-theme
|
2026-03-05 08:03:57 +00:00
|
|
|
|
|
2026-03-10 22:07:14 +00:00
|
|
|
|
# ---- Permissions ---------------------------------------------------------
|
|
|
|
|
|
USER www-data
|
|
|
|
|
|
RUN mkdir -p /var/www/html/wp-content/uploads && \
|
|
|
|
|
|
chmod -R 755 /var/www/html/wp-content/plugins && \
|
|
|
|
|
|
chmod -R 755 /var/www/html/wp-content/themes && \
|
|
|
|
|
|
chmod -R 775 /var/www/html/wp-content/uploads
|
2026-03-04 22:45:28 +00:00
|
|
|
|
|
2026-03-10 22:07:14 +00:00
|
|
|
|
# ---- Healthcheck ---------------------------------------------------------
|
2026-03-05 00:12:31 +00:00
|
|
|
|
HEALTHCHECK --interval=30s --timeout=5s \
|
2026-03-09 19:56:56 +00:00
|
|
|
|
CMD curl -f http://localhost/wp-admin/ || exit 1
|
2026-03-05 00:12:31 +00:00
|
|
|
|
|
2026-03-04 22:45:28 +00:00
|
|
|
|
EXPOSE 80
|
|
|
|
|
|
|
2026-03-10 22:07:14 +00:00
|
|
|
|
# ---- Custom entrypoint scripts -------------------------------------------
|
2026-03-05 07:11:01 +00:00
|
|
|
|
COPY entrypoint.sh /usr/local/bin/
|
2026-03-05 09:45:20 +00:00
|
|
|
|
COPY entrypoint-theme.sh /usr/local/bin/
|
2026-03-10 22:07:14 +00:00
|
|
|
|
USER root
|
|
|
|
|
|
RUN chmod +x /usr/local/bin/entrypoint.sh /usr/local/bin/entrypoint-theme.sh
|
|
|
|
|
|
USER www-data
|
2026-03-05 09:45:20 +00:00
|
|
|
|
|
2026-03-10 22:07:14 +00:00
|
|
|
|
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
|
2026-03-04 22:45:28 +00:00
|
|
|
|
CMD ["apache2-foreground"]
|