94 lines
2.7 KiB
Docker
94 lines
2.7 KiB
Docker
# ============================================
|
|
# Fast Production Dockerfile
|
|
# Single-stage build using CI pre-built assets
|
|
# Saves time by skipping multi-stage node/composer builders
|
|
# ============================================
|
|
#
|
|
# This Dockerfile expects:
|
|
# - vendor/ already populated (from CI composer-install step)
|
|
# - public/build/ already populated (from CI build-frontend step)
|
|
#
|
|
# Build time: ~5-7 min (vs 15-20 min with multi-stage Dockerfile)
|
|
# ============================================
|
|
|
|
FROM 10.100.9.70:5000/library/php:8.3-fpm-alpine
|
|
|
|
LABEL maintainer="CannaBrands Team"
|
|
|
|
# Install system dependencies
|
|
RUN apk add --no-cache \
|
|
nginx \
|
|
supervisor \
|
|
postgresql-dev \
|
|
libpng-dev \
|
|
libjpeg-turbo-dev \
|
|
freetype-dev \
|
|
libzip-dev \
|
|
icu-dev \
|
|
icu-data-full \
|
|
zip \
|
|
unzip \
|
|
git \
|
|
curl \
|
|
bash
|
|
|
|
# Install build dependencies for PHP extensions
|
|
RUN apk add --no-cache --virtual .build-deps \
|
|
autoconf \
|
|
g++ \
|
|
make
|
|
|
|
# Install PHP extensions
|
|
RUN docker-php-ext-configure gd --with-freetype --with-jpeg \
|
|
&& docker-php-ext-install -j$(nproc) \
|
|
pdo_pgsql \
|
|
pgsql \
|
|
gd \
|
|
zip \
|
|
intl \
|
|
pcntl \
|
|
bcmath \
|
|
opcache
|
|
|
|
# Install Redis extension
|
|
RUN pecl install redis \
|
|
&& docker-php-ext-enable redis \
|
|
&& apk del .build-deps
|
|
|
|
WORKDIR /var/www/html
|
|
|
|
ARG GIT_COMMIT_SHA=unknown
|
|
ARG APP_VERSION=dev
|
|
|
|
# Copy application code
|
|
COPY --chown=www-data:www-data . .
|
|
|
|
# Copy pre-built frontend assets (built in CI step)
|
|
# These are already in public/build from the build-frontend step
|
|
|
|
# Copy pre-installed vendor (from CI composer-install step)
|
|
# Already included in COPY . .
|
|
|
|
# Create version metadata file
|
|
RUN echo "VERSION=${APP_VERSION}" > /var/www/html/version.env && \
|
|
echo "COMMIT=${GIT_COMMIT_SHA}" >> /var/www/html/version.env && \
|
|
chown www-data:www-data /var/www/html/version.env
|
|
|
|
# Copy production configurations
|
|
COPY docker/production/nginx/default.conf /etc/nginx/http.d/default.conf
|
|
COPY docker/production/supervisor/supervisord.conf /etc/supervisor/supervisord.conf
|
|
COPY docker/production/php/php.ini /usr/local/etc/php/conf.d/99-custom.ini
|
|
|
|
# Remove default PHP-FPM pool config and use our custom one
|
|
RUN rm -f /usr/local/etc/php-fpm.d/www.conf /usr/local/etc/php-fpm.d/www.conf.default
|
|
COPY docker/production/php/php-fpm.conf /usr/local/etc/php-fpm.d/www.conf
|
|
|
|
# Create supervisor log directory and fix permissions
|
|
RUN mkdir -p /var/log/supervisor \
|
|
&& chown -R www-data:www-data /var/www/html/storage /var/www/html/bootstrap/cache \
|
|
&& chmod -R 775 /var/www/html/storage /var/www/html/bootstrap/cache
|
|
|
|
EXPOSE 80
|
|
|
|
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/supervisord.conf"]
|