42 lines
1.9 KiB
Docker
42 lines
1.9 KiB
Docker
FROM alpine:3.22
|
|
|
|
RUN set -eux; \
|
|
apk add --no-cache \
|
|
apache2 apache2-proxy \
|
|
php84 php84-fpm php84-opcache php84-session \
|
|
php84-mysqli php84-pdo php84-pdo_mysql php84-ctype php84-tokenizer php84-xml php84-gd php84-curl php84-mbstring \
|
|
tzdata curl; \
|
|
mkdir -p /run/apache2 /run/php /var/www/html; \
|
|
# Apache → logy do stdout/stderr, ServerName
|
|
sed -ri 's|^[#[:space:]]*ErrorLog .*|ErrorLog /dev/stderr|g' /etc/apache2/httpd.conf; \
|
|
sed -ri 's|^[#[:space:]]*CustomLog .*|CustomLog /dev/stdout combined|g' /etc/apache2/httpd.conf; \
|
|
sed -ri 's|#ServerName www.example.com:80|ServerName localhost|g' /etc/apache2/httpd.conf; \
|
|
# PHP-FPM: TCP 127.0.0.1:9000
|
|
sed -ri 's|^listen = .*|listen = 127.0.0.1:9000|g' /etc/php84/php-fpm.d/www.conf; \
|
|
# Production ini (pokud je k dispozici)
|
|
if [ -f /etc/php84/php.ini-production ]; then cp /etc/php84/php.ini-production /etc/php84/php.ini; fi; \
|
|
# Alpine default symlink
|
|
if [ -d /var/www/localhost/htdocs ]; then rmdir /var/www/localhost/htdocs || true; ln -s /var/www/html /var/www/localhost/htdocs; fi
|
|
RUN sed -ri 's|^(LoadModule\s+lbmethod_heartbeat_module\b.*)|# \1|' /etc/apache2/httpd.conf
|
|
# Konfigurace Apache pro FPM + DocumentRoot
|
|
COPY apache-phpfpm.conf /etc/apache2/conf.d/php-fpm.conf
|
|
|
|
# Aplikace
|
|
COPY data/www/ /var/www/html/
|
|
|
|
# Jednoduchý healthcheck
|
|
HEALTHCHECK --interval=30s --timeout=3s --retries=3 CMD wget -qO- http://127.0.0.1/ >/dev/null || exit 1
|
|
|
|
LABEL org.opencontainers.image.title="docker-php-alpine" \
|
|
org.opencontainers.image.description="Apache + PHP 8.4 on Alpine (FPM)" \
|
|
org.opencontainers.image.source="https://git.najihu.net/zdenek/docker-php-alpine" \
|
|
org.opencontainers.image.licenses="MIT"
|
|
|
|
# Entrypoint spustí FPM a Apache (root → Apache si sám shodí práva)
|
|
COPY docker-entrypoint.sh /docker-entrypoint.sh
|
|
RUN chmod +x /docker-entrypoint.sh
|
|
|
|
EXPOSE 80
|
|
CMD ["/docker-entrypoint.sh"]
|
|
|