customer-riverside/Dockerfile

121 lines
4.4 KiB
Text
Raw Normal View History

2026-06-11 22:56:14 -08:00
# ── Stage 1: CSS build ────────────────────────────────────────────────────────
FROM node:22-slim AS node-build
WORKDIR /build
COPY package.json tailwind.config.js ./
RUN npm install --include=dev
# Copy only what Tailwind needs to scan + the input CSS
COPY web/modules/custom/riverside_pt/css/tailwind.css \
web/modules/custom/riverside_pt/css/tailwind.css
COPY web/modules/custom/riverside_pt/templates/ \
web/modules/custom/riverside_pt/templates/
COPY web/modules/custom/riverside_pt/src/ \
web/modules/custom/riverside_pt/src/
COPY web/modules/custom/riverside_pt/js/components/ \
web/modules/custom/riverside_pt/js/components/
RUN npm run build
2026-04-19 20:33:56 -08:00
2026-06-11 22:56:14 -08:00
# ── Stage 2: PHP extensions + Composer deps ───────────────────────────────────
FROM php:8.5-fpm AS php-build
2026-04-19 20:33:56 -08:00
RUN apt-get update && apt-get install -y --no-install-recommends \
libpq-dev \
libpng-dev \
libjpeg-dev \
libfreetype-dev \
libzip-dev \
git \
unzip \
2026-05-16 10:45:33 -08:00
curl \
2026-06-11 22:56:14 -08:00
&& docker-php-ext-configure gd --with-freetype --with-jpeg \
&& docker-php-ext-install -j"$(nproc)" \
2026-04-19 20:33:56 -08:00
pdo_pgsql \
pgsql \
gd \
zip \
exif \
2026-06-11 22:56:14 -08:00
bcmath \
&& rm -rf /var/lib/apt/lists/*
2026-04-19 20:33:56 -08:00
2026-06-11 22:10:17 -08:00
RUN curl -fsSL https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
2026-04-19 20:33:56 -08:00
WORKDIR /var/www/html
2026-06-11 22:56:14 -08:00
COPY composer.json ./
RUN composer config repositories.drupal composer https://packages.drupal.org/8 \
&& composer require \
composer/installers:^2.3 \
drupal/core-recommended:^11 \
drupal/core-composer-scaffold:^11 \
"drush/drush:^13 || ^14" \
drupal/webform \
drupal/symfony_mailer \
drupal/claro_compact \
--no-update \
&& composer install --no-dev --optimize-autoloader --no-interaction \
&& rm -rf /root/.composer/cache
# ── Stage 3: Runtime image ────────────────────────────────────────────────────
FROM php:8.5-fpm
2026-04-19 20:33:56 -08:00
2026-06-11 22:56:14 -08:00
# Runtime libs for the compiled PHP extensions (no dev headers).
# If php:8.5-fpm is based on Debian Trixie, rename libpng16-16 → libpng16-16t64
# and libzip4 → libzip4t64 if this apt-get step fails.
RUN apt-get update && apt-get install -y --no-install-recommends \
nginx \
supervisor \
postgresql-client \
libpq5 \
libpng16-16 \
libjpeg62-turbo \
libfreetype6 \
libzip4 \
locales \
curl \
gettext-base \
procps \
&& rm -rf /var/lib/apt/lists/*
2026-05-01 03:26:46 -08:00
2026-06-11 22:56:14 -08:00
# Copy compiled PHP extension .so files and their ini enablement files
COPY --from=php-build /usr/local/lib/php/extensions/ /usr/local/lib/php/extensions/
COPY --from=php-build /usr/local/etc/php/conf.d/ /usr/local/etc/php/conf.d/
2026-05-01 03:26:46 -08:00
2026-06-11 22:56:14 -08:00
ENV PATH="/var/www/html/vendor/bin:${PATH}"
2026-05-01 03:26:46 -08:00
2026-06-11 22:56:14 -08:00
WORKDIR /var/www/html
2026-05-01 03:26:46 -08:00
2026-06-11 22:56:14 -08:00
# Copy scaffolded vendor + web/ from composer stage
COPY --from=php-build /var/www/html/ ./
2026-04-19 20:33:56 -08:00
2026-06-11 22:56:14 -08:00
# Overlay site-specific files on top of the scaffolded web/
2026-04-19 20:33:56 -08:00
COPY web/sites/default/settings.php web/sites/default/settings.php
COPY web/sites/default/files/ web/sites/default/files/
2026-05-01 04:39:57 -08:00
COPY web/modules/custom/ web/modules/custom/
2026-05-12 16:28:47 -08:00
2026-06-11 22:56:14 -08:00
# Overwrite with the minified CSS built in the node stage
COPY --from=node-build /build/web/modules/custom/riverside_pt/css/app.css \
web/modules/custom/riverside_pt/css/app.css
2026-05-16 10:45:33 -08:00
2026-05-12 16:28:47 -08:00
ARG FULLCALENDAR_VERSION=6.1.15
RUN curl -fsSL "https://cdn.jsdelivr.net/npm/fullcalendar@${FULLCALENDAR_VERSION}/index.global.min.js" \
-o web/modules/custom/riverside_pt/js/fullcalendar.min.js
2026-06-11 22:56:14 -08:00
2026-04-19 20:33:56 -08:00
COPY config/sync/ config/sync/
RUN rm -f /etc/nginx/sites-enabled/default
2026-05-24 18:23:05 -08:00
COPY docker/nginx/default.conf /etc/nginx/conf.d/default.conf.template
2026-04-19 20:33:56 -08:00
COPY docker/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
COPY docker/php/entrypoint.sh /entrypoint.sh
2026-06-03 22:30:44 -08:00
RUN chmod +x /entrypoint.sh
2026-04-19 20:33:56 -08:00
2026-06-04 23:04:37 -08:00
RUN sed -i 's|;error_log = log/php-fpm.log|error_log = /var/log/php-fpm.log|' /usr/local/etc/php-fpm.conf && \
{ \
2026-06-04 22:05:25 -08:00
echo 'clear_env = no'; \
echo 'catch_workers_output = yes'; \
echo 'php_admin_flag[log_errors] = on'; \
2026-06-04 23:04:37 -08:00
echo 'php_admin_value[error_log] = /var/log/php-fpm.www.log'; \
2026-06-04 22:05:25 -08:00
} >> /usr/local/etc/php-fpm.d/zz-env.conf
2026-06-04 21:52:41 -08:00
2026-06-04 23:04:37 -08:00
RUN chmod 444 web/sites/default/settings.php
2026-04-19 20:33:56 -08:00
EXPOSE 80
ENTRYPOINT ["/entrypoint.sh"]