Files
InvoiceShelf/docker/production/Dockerfile
Darko Gjorgjijoski c04b84e5b5 ci(docker): release-driven tags, drop nightly cron, add 3.x pre-release channel
Remove the scheduled nightly/alpha builds; gate :latest on a single LATEST_MAJOR; publish :beta/:next for pre-releases; keep a transitional :nightly alias on stable. Also fix the production Dockerfile so a stale host public/build can no longer clobber the freshly built frontend (reorder COPY, ignore public/build).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-14 23:42:11 +02:00

46 lines
2.0 KiB
Docker

FROM --platform=$BUILDPLATFORM node:24 AS static_builder
WORKDIR /var/www/html
COPY . /var/www/html
RUN corepack enable && pnpm install --frozen-lockfile && pnpm build
FROM serversideup/php:8.4-fpm-nginx-alpine AS base
USER root
RUN apk add --no-cache bash nano mariadb-client postgresql-client sqlite
RUN install-php-extensions exif
RUN install-php-extensions pgsql
RUN install-php-extensions sqlite3
RUN install-php-extensions imagick
RUN install-php-extensions mbstring
RUN install-php-extensions gd
RUN install-php-extensions xml
RUN install-php-extensions zip
RUN install-php-extensions redis
RUN install-php-extensions bcmath
RUN install-php-extensions intl
RUN install-php-extensions curl
FROM base AS production
ENV AUTORUN_ENABLED=true
ENV PHP_OPCACHE_ENABLE=1
# Set `www-data` as the user to start FPM
USER root
RUN echo "" >> /usr/local/etc/php-fpm.d/docker-php-serversideup-pool.conf && \
echo "user = www-data" >> /usr/local/etc/php-fpm.d/docker-php-serversideup-pool.conf && \
echo "group = www-data" >> /usr/local/etc/php-fpm.d/docker-php-serversideup-pool.conf
# Revert back to www-data, non-root user
USER www-data
# Copy application files first, then overlay the freshly-built frontend assets
# LAST. public/build is gitignored, so it's absent in CI but may exist in a local
# working tree — copying it after `COPY .` guarantees the stale host build can
# never clobber the fresh one produced by static_builder.
COPY --chown=www-data:www-data . /var/www/html
COPY --from=static_builder --chown=www-data:www-data /var/www/html/public/build /var/www/html/public/build
RUN composer install --prefer-dist --no-dev --optimize-autoloader
# Copy entrypoint and inject script, and make sure they are executable
COPY --chmod=755 docker/production/inject.sh /inject.sh
COPY --chmod=755 docker/production/entrypoint.d/ /etc/entrypoint.d/