dockerfile/Dockerfile hinzugefügt
This commit is contained in:
commit
c8254d3349
1 file changed
+96
@@ -0,0 +1,96 @@
|
|||||||
|
FROM php:8.5-apache
|
||||||
|
|
||||||
|
# System-Pakete inkl. msmtp und msmtp-mta installieren
|
||||||
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||||
|
openssl \
|
||||||
|
ca-certificates \
|
||||||
|
libmagickwand-dev \
|
||||||
|
libzip-dev \
|
||||||
|
zip \
|
||||||
|
libpng-dev \
|
||||||
|
libwebp-dev \
|
||||||
|
libicu-dev \
|
||||||
|
msmtp \
|
||||||
|
msmtp-mta \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
# PHP- und Apache-Konfigurationen kopieren
|
||||||
|
COPY php.ini /usr/local/etc/php/php.ini
|
||||||
|
COPY apache2.conf /etc/apache2/apache2.conf
|
||||||
|
COPY 000-default.conf /etc/apache2/sites-available/000-default.conf
|
||||||
|
|
||||||
|
# SSL-Zertifikat erstellen
|
||||||
|
RUN mkdir -p /etc/apache2/certs && \
|
||||||
|
openssl req -new -newkey rsa:4096 -x509 -sha256 -days 3650 -nodes \
|
||||||
|
-out /etc/apache2/certs/apache.crt \
|
||||||
|
-keyout /etc/apache2/certs/apache.key \
|
||||||
|
-subj "/C=GB/ST=London/L=London/O=Global Security/OU=IT Department/CN=example.com"
|
||||||
|
|
||||||
|
# OPcache konfigurieren (in PHP 8.5 fest integriert)
|
||||||
|
ENV PHP_OPCACHE_VALIDATE_TIMESTAMPS="0"
|
||||||
|
ENV PHP_OPCACHE_MAX_ACCELERATED_FILES="10000"
|
||||||
|
ENV PHP_OPCACHE_MEMORY_CONSUMPTION="192"
|
||||||
|
ENV PHP_OPCACHE_MAX_WASTED_PERCENTAGE="10"
|
||||||
|
ENV PHP_OPCACHE_ENABLE="1"
|
||||||
|
|
||||||
|
RUN { \
|
||||||
|
echo "[opcache]"; \
|
||||||
|
echo "opcache.enable=${PHP_OPCACHE_ENABLE}"; \
|
||||||
|
echo "opcache.revalidate_freq=0"; \
|
||||||
|
echo "opcache.validate_timestamps=${PHP_OPCACHE_VALIDATE_TIMESTAMPS}"; \
|
||||||
|
echo "opcache.max_accelerated_files=${PHP_OPCACHE_MAX_ACCELERATED_FILES}"; \
|
||||||
|
echo "opcache.memory_consumption=${PHP_OPCACHE_MEMORY_CONSUMPTION}"; \
|
||||||
|
echo "opcache.max_wasted_percentage=${PHP_OPCACHE_MAX_WASTED_PERCENTAGE}"; \
|
||||||
|
echo "opcache.interned_strings_buffer=16"; \
|
||||||
|
} > /usr/local/etc/php/conf.d/opcache.ini
|
||||||
|
|
||||||
|
# PHP-Extensions installieren
|
||||||
|
RUN docker-php-ext-configure gd --with-webp \
|
||||||
|
&& docker-php-ext-install -j$(nproc) \
|
||||||
|
mysqli \
|
||||||
|
exif \
|
||||||
|
zip \
|
||||||
|
gd \
|
||||||
|
intl
|
||||||
|
|
||||||
|
# Imagick installieren
|
||||||
|
RUN pecl install imagick \
|
||||||
|
&& docker-php-ext-enable imagick
|
||||||
|
|
||||||
|
# Apache-Module aktivieren
|
||||||
|
RUN a2enmod ssl rewrite
|
||||||
|
|
||||||
|
# Entrypoint-Skript erstellen, das msmtp beim Container-Start aus ENV-Variablen konfiguriert
|
||||||
|
RUN { \
|
||||||
|
echo '#!/bin/sh'; \
|
||||||
|
echo 'set -e'; \
|
||||||
|
echo 'cat <<EOF > /etc/msmtprc'; \
|
||||||
|
echo 'defaults'; \
|
||||||
|
echo 'auth on'; \
|
||||||
|
echo 'tls ${SMTP_TLS:-on}'; \
|
||||||
|
echo 'tls_starttls ${SMTP_STARTTLS:-on}'; \
|
||||||
|
echo 'tls_trust_file /etc/ssl/certs/ca-certificates.crt'; \
|
||||||
|
echo 'logfile /var/log/msmtp.log'; \
|
||||||
|
echo 'aliases /etc/aliases'; \
|
||||||
|
echo ''; \
|
||||||
|
echo 'account default'; \
|
||||||
|
echo 'host ${SMTP_HOST}'; \
|
||||||
|
echo 'port ${SMTP_PORT:-587}'; \
|
||||||
|
echo 'from ${SMTP_FROM}'; \
|
||||||
|
echo 'user ${SMTP_USER}'; \
|
||||||
|
echo 'password ${SMTP_PASS}'; \
|
||||||
|
echo 'EOF'; \
|
||||||
|
echo 'chown www-data:www-data /etc/msmtprc'; \
|
||||||
|
echo 'chmod 600 /etc/msmtprc'; \
|
||||||
|
echo 'cat <<EOF > /etc/aliases'; \
|
||||||
|
echo 'root: ${SMTP_FROM}'; \
|
||||||
|
echo 'www-data: ${SMTP_FROM}'; \
|
||||||
|
echo 'default: ${SMTP_FROM}'; \
|
||||||
|
echo 'EOF'; \
|
||||||
|
echo 'touch /var/log/msmtp.log && chown www-data:www-data /var/log/msmtp.log'; \
|
||||||
|
echo 'exec docker-php-entrypoint "$@"'; \
|
||||||
|
} > /usr/local/bin/msmtp-entrypoint.sh \
|
||||||
|
&& chmod +x /usr/local/bin/msmtp-entrypoint.sh
|
||||||
|
|
||||||
|
ENTRYPOINT ["msmtp-entrypoint.sh"]
|
||||||
|
CMD ["apache2-foreground"]
|
||||||
Reference in new issue
Block a user