chore: complete update
This commit is contained in:
99
.archive/docker/php/Dockerfile
Normal file
99
.archive/docker/php/Dockerfile
Normal file
@@ -0,0 +1,99 @@
|
||||
# Dockerfile für PHP-FPM
|
||||
FROM php:8.4-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 \
|
||||
&& 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
|
||||
|
||||
RUN docker-php-ext-install -j$(nproc) \
|
||||
zip \
|
||||
pdo \
|
||||
pdo_mysql \
|
||||
opcache \
|
||||
pcntl \
|
||||
posix \
|
||||
shmop
|
||||
|
||||
|
||||
|
||||
# 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
|
||||
|
||||
# Kopiere composer.json
|
||||
COPY composer.json ./
|
||||
|
||||
# Kopiere composer.lock falls vorhanden (robuste Lösung)
|
||||
COPY composer.loc[k] ./
|
||||
|
||||
# Falls keine composer.lock existiert, erstelle eine leere um Layer-Caching zu ermöglichen
|
||||
RUN [ ! -f composer.lock ] && touch composer.lock || true
|
||||
|
||||
# Remove potentially corrupted composer.lock and install dependencies
|
||||
RUN rm -f composer.lock && \
|
||||
if [ "$ENV" = "prod" ]; then \
|
||||
composer install --no-dev --no-scripts --no-autoloader --optimize-autoloader; \
|
||||
else \
|
||||
composer install --no-scripts --no-autoloader; \
|
||||
fi
|
||||
|
||||
# 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
|
||||
|
||||
# Wenn dev, kopiere auch xdebug-Konfiguration
|
||||
RUN if [ "$ENV" = "dev" ]; then \
|
||||
mkdir -p /usr/local/etc/php/conf.d/; \
|
||||
fi
|
||||
COPY docker/php/xdebug.ini /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini
|
||||
|
||||
# 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
|
||||
|
||||
# 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
|
||||
|
||||
RUN mkdir -p /var/www/html/cache && \
|
||||
chown -R 1000:1000 /var/www/html/cache && \
|
||||
chmod -R 775 /var/www/html/cache
|
||||
|
||||
ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]
|
||||
CMD ["php-fpm"]
|
||||
4
.archive/docker/php/docker-entrypoint.sh
Normal file
4
.archive/docker/php/docker-entrypoint.sh
Normal file
@@ -0,0 +1,4 @@
|
||||
#!/bin/bash
|
||||
chown -R www-data:www-data /var/www/html/cache
|
||||
chmod -R 775 /var/www/html/cache
|
||||
exec "$@"
|
||||
10
.archive/docker/php/php.common.ini
Normal file
10
.archive/docker/php/php.common.ini
Normal file
@@ -0,0 +1,10 @@
|
||||
expose_php = Off
|
||||
|
||||
session.cookie_secure = 1
|
||||
session.cookie_httponly = 1
|
||||
session.cookie_samesite = Lax
|
||||
|
||||
|
||||
date.timezone = Europe/Berlin
|
||||
|
||||
opcache.preload=/var/www/michaelschiemer/src/preload.php
|
||||
29
.archive/docker/php/php.development.ini
Normal file
29
.archive/docker/php/php.development.ini
Normal file
@@ -0,0 +1,29 @@
|
||||
; php.ini für Entwicklung
|
||||
include = php.common.ini
|
||||
|
||||
|
||||
[opcache]
|
||||
opcache.enable=0
|
||||
opcache.enable_cli=0
|
||||
opcache.memory_consumption=128
|
||||
opcache.max_accelerated_files=10000
|
||||
; Häufigere Validierung im Dev-Modus
|
||||
opcache.revalidate_freq=0
|
||||
; Timestamps-Validierung einschalten für Entwicklung
|
||||
opcache.validate_timestamps=1
|
||||
|
||||
opcache.file_cache=
|
||||
realpath_cache_ttl=0
|
||||
|
||||
opcache.interned_strings_buffer=16
|
||||
|
||||
|
||||
display_errors = On
|
||||
display_startup_errors = On
|
||||
error_reporting = E_ALL
|
||||
memory_limit = 512M
|
||||
upload_max_filesize = 20M
|
||||
post_max_size = 25M
|
||||
max_execution_time = 60
|
||||
|
||||
; Xdebug-Einstellungen können auch hier hinzugefügt werden, falls gewünscht
|
||||
31
.archive/docker/php/php.prod.ini
Normal file
31
.archive/docker/php/php.prod.ini
Normal file
@@ -0,0 +1,31 @@
|
||||
; php.ini für Produktion
|
||||
include = php.common.ini
|
||||
|
||||
[opcache]
|
||||
; Aktiviere OPcache
|
||||
opcache.enable=1
|
||||
; Aktiviere OPcache für CLI-Anwendungen (optional)
|
||||
opcache.enable_cli=0
|
||||
; Maximale Speichernutzung für Cache in MB
|
||||
opcache.memory_consumption=128
|
||||
; Maximale Anzahl an gecachten Dateien
|
||||
opcache.max_accelerated_files=10000
|
||||
; Wie oft wird der Cache validiert (0 = bei jedem Request, empfohlen für Entwicklung)
|
||||
; In Produktion höher setzen für bessere Performance
|
||||
opcache.revalidate_freq=60
|
||||
; Cache-Zeitstempel prüfen (0 für Produktionsumgebungen)
|
||||
opcache.validate_timestamps=0
|
||||
; Performance-Optimierungen
|
||||
opcache.interned_strings_buffer=16
|
||||
; JIT (Just-In-Time Compilation) - Optional für PHP 8.0+
|
||||
opcache.jit_buffer_size=100M
|
||||
opcache.jit=1255
|
||||
|
||||
|
||||
display_errors = Off
|
||||
display_startup_errors = Off
|
||||
error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT
|
||||
memory_limit = 256M
|
||||
upload_max_filesize = 10M
|
||||
post_max_size = 12M
|
||||
max_execution_time = 30
|
||||
7
.archive/docker/php/xdebug.ini
Normal file
7
.archive/docker/php/xdebug.ini
Normal file
@@ -0,0 +1,7 @@
|
||||
; Xdebug 3 Konfiguration
|
||||
xdebug.mode=${XDEBUG_MODE:-off}
|
||||
xdebug.client_host=host.docker.internal
|
||||
xdebug.client_port=9003
|
||||
xdebug.start_with_request=yes
|
||||
xdebug.log=/var/log/xdebug.log
|
||||
xdebug.idekey=PHPSTORM
|
||||
Reference in New Issue
Block a user