verze 0.1.0
This commit is contained in:
8
.gitignore
vendored
8
.gitignore
vendored
@@ -0,0 +1,8 @@
|
|||||||
|
.env
|
||||||
|
.git
|
||||||
|
.gitignore
|
||||||
|
**/.DS_Store
|
||||||
|
**/node_modules
|
||||||
|
**/vendor
|
||||||
|
tmp
|
||||||
|
*.log
|
||||||
|
|||||||
41
Dockerfile
Normal file
41
Dockerfile
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
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"]
|
||||||
|
|
||||||
14
apache-phpfpm.conf
Normal file
14
apache-phpfpm.conf
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
# JASNĚ definovaný kořen
|
||||||
|
DocumentRoot "/var/www/html"
|
||||||
|
|
||||||
|
<Directory "/var/www/html">
|
||||||
|
AllowOverride All
|
||||||
|
Require all granted
|
||||||
|
</Directory>
|
||||||
|
|
||||||
|
# PHP má přednost
|
||||||
|
DirectoryIndex index.php index.html
|
||||||
|
|
||||||
|
# Předáme FPMu plnou cestu k .php
|
||||||
|
ProxyPassMatch "^/(.*\.php(/.*)?)$" "fcgi://127.0.0.1:9000/var/www/html/$1"
|
||||||
|
|
||||||
3
data/www/index.php
Normal file
3
data/www/index.php
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
<?php
|
||||||
|
phpinfo();
|
||||||
|
?>
|
||||||
9
docker-compose.yml
Normal file
9
docker-compose.yml
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
services:
|
||||||
|
web:
|
||||||
|
image: git.najihu.net/zdenek/docker-php-alpine:latest
|
||||||
|
ports: ["8080:80"]
|
||||||
|
|
||||||
|
# volumes:
|
||||||
|
# - ./data/www:/var/www/html
|
||||||
|
restart: unless-stopped
|
||||||
|
|
||||||
11
docker-entrypoint.sh
Normal file
11
docker-entrypoint.sh
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# NEměním vlastníky – respektuju bind-mounty/práva z hosta
|
||||||
|
|
||||||
|
# PHP-FPM do pozadí (foreground režim)
|
||||||
|
php-fpm84 -F &
|
||||||
|
|
||||||
|
# Apache jako root (zapíše PID, pak shodí práva podle httpd.conf)
|
||||||
|
exec /usr/sbin/httpd -D FOREGROUND
|
||||||
|
|
||||||
Reference in New Issue
Block a user