- Add comprehensive health check system with multiple endpoints - Add Prometheus metrics endpoint - Add production logging configurations (5 strategies) - Add complete deployment documentation suite: * QUICKSTART.md - 30-minute deployment guide * DEPLOYMENT_CHECKLIST.md - Printable verification checklist * DEPLOYMENT_WORKFLOW.md - Complete deployment lifecycle * PRODUCTION_DEPLOYMENT.md - Comprehensive technical reference * production-logging.md - Logging configuration guide * ANSIBLE_DEPLOYMENT.md - Infrastructure as Code automation * README.md - Navigation hub * DEPLOYMENT_SUMMARY.md - Executive summary - Add deployment scripts and automation - Add DEPLOYMENT_PLAN.md - Concrete plan for immediate deployment - Update README with production-ready features All production infrastructure is now complete and ready for deployment.
106 lines
2.9 KiB
Docker
106 lines
2.9 KiB
Docker
# Dockerfile für PHP-FPM
|
|
FROM php:8.5.0RC2-fpm AS base
|
|
|
|
# System-Abhängigkeiten: Werden selten geändert, daher ein eigener Layer
|
|
RUN apt-get update && apt-get install -y \
|
|
git \
|
|
unzip \
|
|
libzip-dev \
|
|
zip \
|
|
libpng-dev \
|
|
libjpeg-dev \
|
|
libfreetype6-dev \
|
|
libwebp-dev \
|
|
libavif-dev \
|
|
libxpm-dev \
|
|
libsodium-dev \
|
|
libpq-dev \
|
|
&& apt-get clean \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
RUN docker-php-ext-configure gd \
|
|
--with-freetype \
|
|
--with-jpeg \
|
|
--with-webp \
|
|
--with-avif \
|
|
--with-xpm \
|
|
&& docker-php-ext-install -j$(nproc) gd
|
|
|
|
# Install PHP extensions (opcache and sodium are already built into PHP 8.5)
|
|
RUN docker-php-ext-install -j$(nproc) \
|
|
zip \
|
|
pdo \
|
|
pdo_mysql \
|
|
pdo_pgsql \
|
|
pcntl \
|
|
posix \
|
|
shmop \
|
|
bcmath
|
|
|
|
# Skip PECL extensions for PHP 8.5 RC compatibility
|
|
# RUN pecl install apcu redis \
|
|
# && docker-php-ext-enable apcu redis
|
|
|
|
# RUN echo "apc.enable_cli=1" >> /usr/local/etc/php/conf.d/docker-php-ext-apcu.ini \
|
|
# && echo "apc.shm_size=128M" >> /usr/local/etc/php/conf.d/docker-php-ext-apcu.ini
|
|
|
|
# Composer installieren
|
|
RUN curl -sS https://getcomposer.org/installer | php \
|
|
&& mv composer.phar /usr/local/bin/composer
|
|
|
|
# Installiere Xdebug nur im Entwicklungsmodus
|
|
ARG ENV=prod
|
|
RUN if [ "$ENV" = "dev" ]; then \
|
|
pecl install xdebug \
|
|
&& docker-php-ext-enable xdebug; \
|
|
fi
|
|
|
|
WORKDIR /var/www/html
|
|
|
|
# Composer Dependencies (für besseres Caching)
|
|
COPY composer.json ./
|
|
COPY composer.lock* ./
|
|
RUN composer install --no-scripts --no-autoloader --ignore-platform-reqs || \
|
|
(composer install --no-scripts --no-autoloader --no-dev --ignore-platform-reqs || \
|
|
echo "Composer install failed, continuing without dependencies")
|
|
|
|
|
|
# Kopiere PHP-Konfigurationen
|
|
COPY docker/php/php.common.ini /usr/local/etc/php/php.common.ini
|
|
COPY docker/php/php.${ENV}.ini /usr/local/etc/php/php.ini
|
|
|
|
# Xdebug-Konfiguration nur wenn dev
|
|
RUN if [ "$ENV" = "dev" ] && [ -f docker/php/xdebug.ini ]; then \
|
|
cp docker/php/xdebug.ini /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini; \
|
|
fi
|
|
|
|
# Kopiere den Rest des Projekts
|
|
COPY . .
|
|
|
|
# Optimiere Autoloader
|
|
RUN composer dump-autoload --optimize
|
|
|
|
# <<--- ALLE zusätzlichen System-Dateien und chmod noch als root!
|
|
COPY docker/php/docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh
|
|
RUN chmod +x /usr/local/bin/docker-entrypoint.sh
|
|
|
|
RUN mkdir -p /var/www/html/cache \
|
|
/var/www/html/storage \
|
|
/var/www/html/storage/logs \
|
|
/var/www/html/storage/cache \
|
|
/var/www/html/storage/analytics \
|
|
/var/www/html/var \
|
|
/var/www/html/var/cache \
|
|
/var/www/html/var/logs
|
|
|
|
# Erstelle uploads-Verzeichnis
|
|
RUN mkdir -p /var/www/html/storage/uploads
|
|
|
|
# Danach erst den Nutzer wechseln!
|
|
RUN groupadd -g 1000 appuser && useradd -u 1000 -g appuser -m appuser
|
|
RUN chown -R appuser:appuser /var/www/html
|
|
USER appuser
|
|
|
|
ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]
|
|
CMD ["php-fpm"]
|