From 6d6f5de012ee0a2383e8e63417b437436189a7e5 Mon Sep 17 00:00:00 2001 From: Jean-Christian Denis Date: Sat, 2 Nov 2024 14:47:50 +0100 Subject: [PATCH] add alpine image --- README.md | 19 ++- alpine/nginx/2.31/Dockerfile | 87 +++++++++++++ alpine/nginx/2.31/docker-compose.yaml | 9 ++ alpine/nginx/2.31/docker-entrypoint.sh | 43 +++++++ alpine/nginx/2.31/nginx.conf | 67 ++++++++++ alpine/nginx/2.31/php-fpm.conf | 21 ++++ alpine/nginx/2.31/php.ini | 116 ++++++++++++++++++ alpine/nginx/docker-compose.yaml | 30 +++++ alpine/nginx/latest/Dockerfile | 87 +++++++++++++ .../nginx/latest/docker-compose.yaml | 3 +- .../nginx/latest/docker-entrypoint.sh | 30 ++--- alpine/nginx/latest/nginx.conf | 67 ++++++++++ alpine/nginx/latest/php-fpm.conf | 21 ++++ alpine/nginx/latest/php.ini | 116 ++++++++++++++++++ debian/nginx/docker-compose.yaml | 2 +- debian/nginx/latest/Dockerfile | 62 ---------- debian/nginx/latest/server.conf | 37 ------ 17 files changed, 697 insertions(+), 120 deletions(-) create mode 100644 alpine/nginx/2.31/Dockerfile create mode 100644 alpine/nginx/2.31/docker-compose.yaml create mode 100644 alpine/nginx/2.31/docker-entrypoint.sh create mode 100644 alpine/nginx/2.31/nginx.conf create mode 100644 alpine/nginx/2.31/php-fpm.conf create mode 100644 alpine/nginx/2.31/php.ini create mode 100644 alpine/nginx/docker-compose.yaml create mode 100644 alpine/nginx/latest/Dockerfile rename {debian => alpine}/nginx/latest/docker-compose.yaml (67%) rename {debian => alpine}/nginx/latest/docker-entrypoint.sh (50%) create mode 100644 alpine/nginx/latest/nginx.conf create mode 100644 alpine/nginx/latest/php-fpm.conf create mode 100644 alpine/nginx/latest/php.ini delete mode 100644 debian/nginx/latest/Dockerfile delete mode 100644 debian/nginx/latest/server.conf diff --git a/README.md b/README.md index b630fbb..ee24ea6 100644 --- a/README.md +++ b/README.md @@ -22,11 +22,13 @@ It is hightly based on work from [darknao](https://github.com/darknao/docker-dot dotclear_version-server_type -* jcpd/docker-dotclear:latest is base on stable Debian / Nginx / PHP-FPM +* jcpd/docker-dotclear:latest is base on stable Alpine / Nginx / PHP-FPM * jcpd/docker-dotclear:x.xx-dnf is based on stable Debian / Nginx / PHP-FPM * jcpd/docker-dotclear:x.xx-anf is based on stable Alpine / Nginx / PHP-FPM * ... (next to come) +### DOCKER + Exemple of a docker compose file with a mariadb database. services: @@ -78,7 +80,16 @@ Builds should support postgresql and mysql database. On first run you should wait that container download ans install required version of Dotclear... -## TODO +### BLOG + +These images support Dotclear URL rewriting in PATH INFO mode. +To configure default blog, go to the administration interface at http://localhost/admin, + * left side menu _Blog settings_ + * panel _Advanced parameters_ + * set _Blog URL_ to http://localhost/ (with trailing slash) + * set _URL scan method_ to 'PATH_INFO' + +### TODO * Disable upgrade from Dotclear. Should only use upgrade from container restart ? * or Fix downgrade on container restart when Dotclear has been upgraded from UI. @@ -89,12 +100,12 @@ On first run you should wait that container download ans install required versio * Enhance server and php configuration. From x.conf files. * Add builds from Alpine and Apache and maybe without FPM. -## CONTRIBUTING +### CONTRIBUTING This image is an open source project. If you'd like to contribute, please read the [CONTRIBUTING file](/CONTRIBUTING.md). You can submit a pull request, or feel free to use any other way you'd prefer. -## License +### LICENSE Copyright Jean-Christian Paul Denis AGPL-v3 diff --git a/alpine/nginx/2.31/Dockerfile b/alpine/nginx/2.31/Dockerfile new file mode 100644 index 0000000..98c9a87 --- /dev/null +++ b/alpine/nginx/2.31/Dockerfile @@ -0,0 +1,87 @@ +# docker-dotclear:2.31-anf + +## +# Alpine +## + +FROM alpine:latest + +RUN echo "UTC" > /etc/timezone + +## +# Nginx +## + +RUN adduser -D -g 'www' www +RUN apk add --no-cache --update \ + nginx \ + curl \ + tar \ + unzip + +RUN mkdir -p /var/www/html \ + && chown -R www:www /var/lib/nginx \ + && chown -R www:www /var/www + +COPY nginx.conf /etc/nginx/nginx.conf + +WORKDIR /var/www/html + +## +# PHP +## + +ENV VER_PHP php83 + +RUN apk add --no-cache --update \ + ${VER_PHP}-common \ + ${VER_PHP}-cli \ + ${VER_PHP}-fpm \ + ${VER_PHP}-session \ + ${VER_PHP}-curl \ + ${VER_PHP}-gd \ + ${VER_PHP}-gmp \ + ${VER_PHP}-exif \ + ${VER_PHP}-tidy \ + ${VER_PHP}-intl \ + ${VER_PHP}-json \ + ${VER_PHP}-mbstring \ + ${VER_PHP}-iconv \ + ${VER_PHP}-gettext \ + ${VER_PHP}-mysqli \ + ${VER_PHP}-opcache \ + ${VER_PHP}-dom \ + ${VER_PHP}-xml \ + ${VER_PHP}-simplexml \ + ${VER_PHP}-zip \ + ${VER_PHP}-sqlite3 + +COPY php.ini /etc/${VER_PHP}/php.ini +COPY php-fpm.conf /etc/${VER_PHP}/php-fpm.d/www.conf + +## +# Dotclear +## + +ENV VER_DOTCLEAR 2.31 +ENV MD5_DOTCLEAR ec08bbcee14132ac7bcefb8ce5d415ed + +RUN mkdir -p /usr/src/dotclear \ + && curl -fsSL -o dotclear.zip "http://download.dotclear.org/attic/dotclear-${VER_DOTCLEAR}.zip" \ + && echo "$MD5_DOTCLEAR dotclear.zip" | md5sum -c - \ + && unzip -d /usr/src dotclear.zip \ + && rm dotclear.zip \ + && chown -R www:www /usr/src/dotclear \ + && chmod -R 755 /usr/src/dotclear/public /usr/src/dotclear/cache \ + && rm -f /var/www/html/* + +## +# END +## + +EXPOSE 80 + +ADD docker-entrypoint.sh /entrypoint.sh +ENTRYPOINT ["/bin/sh", "/entrypoint.sh"] + +HEALTHCHECK --timeout=10s CMD curl --silent --fail http://127.0.0.1:80/fpm-ping || exit 1 \ No newline at end of file diff --git a/alpine/nginx/2.31/docker-compose.yaml b/alpine/nginx/2.31/docker-compose.yaml new file mode 100644 index 0000000..aa15140 --- /dev/null +++ b/alpine/nginx/2.31/docker-compose.yaml @@ -0,0 +1,9 @@ +# docker-dotclear:2.31-anf + +services: + dc_app: + build: + context: . + dockerfile: Dockerfile + image: docker-dotclear:2.31-anf + container_name: dotclear \ No newline at end of file diff --git a/alpine/nginx/2.31/docker-entrypoint.sh b/alpine/nginx/2.31/docker-entrypoint.sh new file mode 100644 index 0000000..d060dc2 --- /dev/null +++ b/alpine/nginx/2.31/docker-entrypoint.sh @@ -0,0 +1,43 @@ +#!/bin/sh + +# docker-dotclear:2.31-anf + +set -e + +# Check if Dotclear exists +if ! [ -e index.php -a -e src/App.php ]; then + # First installation + echo >&2 "Dotclear not found in $(pwd) - copying now..." + if [ "$(ls -A)" ]; then + echo >&2 "WARNING: $(pwd) is not empty - press Ctrl+C now if this is an error!" + ( set -x; ls -A; sleep 5 ) + fi + echo >&2 "Copying Dotclear files..." + tar cf - --one-file-system -C /usr/src/dotclear . | tar xf - + echo >&2 "Complete! Dotclear has been successfully copied to $(pwd)" +else + echo >&2 "Dotclear found in $(pwd), checking upgrade..." + # Check if Dotclear needs upgrade + VER_CURRENT=$(sed -n "s/^\s*\"release_version\":\s*\"\(.*\)\",/\1/p" release.json) + if [ "$VER_CURRENT" != "$VER_DOTCLEAR" ]; then + echo >&2 "Upgrading Dotclear files from ${VER_CURRENT} to ${VER_DOTCLEAR}, please wait..." + tar cf - --one-file-system -C /usr/src/dotclear . | tar xf - + echo >&2 "Complete! Dotclear files have been successfully upgraded to ${VER_DOTCLEAR}" + else + echo >&2 "No need to upgrade Dotclear ${VER_DOTCLEAR}" + fi +fi + +# Permissions +echo >&2 "Setting up permissions..." +chown -R www:www /var/www/html + +# Summary +echo >&2 "Alpine $(cat /etc/alpine-release)" +echo >&2 "$(nginx -v)PHP $(php -r "echo PHP_VERSION;")" +echo >&2 "Dotclear: ${VER_DOTCLEAR}" + +php-fpm83 -D # FPM must start first in daemon mode +nginx # Then nginx in no daemon mode + +exec "$@" \ No newline at end of file diff --git a/alpine/nginx/2.31/nginx.conf b/alpine/nginx/2.31/nginx.conf new file mode 100644 index 0000000..eeb1529 --- /dev/null +++ b/alpine/nginx/2.31/nginx.conf @@ -0,0 +1,67 @@ +; docker-dotclear:2.31-anf + +user www; +daemon off; +worker_processes auto; +error_log /dev/stderr notice; +pid /var/run/nginx/nginx.pid; + +events { + worker_connections 1024; +} + +http { + include /etc/nginx/mime.types; + default_type application/octet-stream; + sendfile on; + #access_log /var/log/nginx/access.log; + keepalive_timeout 3000; + + server { + listen 80; + root /var/www/html; + index index.php index.html; + server_name localhost; + client_max_body_size 32m; + #error_page 500 502 503 504 /50x.html; + + location ~ ^/(db|cache|plugins|inc) { + deny all; + return 404; + } + + location / { + try_files $uri $uri/ @dotclear_path_info; + } + + location @dotclear_path_info { + rewrite ^/(.*) /index.php/$1 last; + } + + location ~ [^/]\.php(/|$) { + fastcgi_split_path_info ^(.+?\.php)(/.*)$; + if (!-f $document_root$fastcgi_script_name) { + return 404; + } + + include fastcgi_params; + set $path_info $fastcgi_path_info; + fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; + fastcgi_param PATH_INFO $fastcgi_path_info; + fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info; + + #fastcgi_pass 127.0.0.1:9000; + fastcgi_pass unix:/run/php-fpm.sock; + fastcgi_index index.php; + } + + location ~ ^/(fpm-ping)$ { + access_log off; + allow 127.0.0.1; + deny all; + fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; + include fastcgi_params; + fastcgi_pass unix:/run/php-fpm.sock; + } + } +} \ No newline at end of file diff --git a/alpine/nginx/2.31/php-fpm.conf b/alpine/nginx/2.31/php-fpm.conf new file mode 100644 index 0000000..4b40b35 --- /dev/null +++ b/alpine/nginx/2.31/php-fpm.conf @@ -0,0 +1,21 @@ +; docker-dotclear:2.31-anf + +[global] +error_log = /dev/stderr +pid = /var/run/php-fpm.pid + +[www] +user = www +group = www +listen = /run/php-fpm.sock +listen.owner = www +listen.group = www +listen.mode = 0660 +pm = ondemand +pm.max_children = 100 +pm.process_idle_timeout = 10s; +pm.max_requests = 1000 +ping.path = /fpm-ping +catch_workers_output = yes +decorate_workers_output = no +clear_env = no diff --git a/alpine/nginx/2.31/php.ini b/alpine/nginx/2.31/php.ini new file mode 100644 index 0000000..7abbfe2 --- /dev/null +++ b/alpine/nginx/2.31/php.ini @@ -0,0 +1,116 @@ +; docker-dotclear:2.31-anf + +[PHP] + +engine = On +short_open_tag = Off +precision = 14 +output_buffering = 4096 +zlib.output_compression = Off +implicit_flush = Off +unserialize_callback_func = +serialize_precision = -1 +disable_functions = +disable_classes = +zend.enable_gc = On +zend.exception_ignore_args = On +zend.exception_string_param_max_len = 0 + +expose_php = On + +max_execution_time = 30 +max_input_time = 60 +memory_limit = 512M +max_input_vars = 1500 + +error_reporting = E_COMPILE_ERROR|E_RECOVERABLE_ERROR|E_ERROR|E_CORE_ERROR +display_errors = On +display_startup_errors = On +log_errors = On +ignore_repeated_errors = Off +ignore_repeated_source = Off +report_memleaks = On +error_log = /dev/stderr + +variables_order = "GPCS" +request_order = "GP" +register_argc_argv = Off +auto_globals_jit = On +post_max_size = 100M +auto_prepend_file = +auto_append_file = +default_mimetype = "text/html" +default_charset = "UTF-8" + +include_path = ".:/usr/share/php83" +doc_root = +user_dir = +enable_dl = Off + +file_uploads = On +upload_max_filesize = 50M +max_file_uploads = 200 + +allow_url_fopen = On +allow_url_include = Off +default_socket_timeout = 60 + +[CLI Server] +cli_server.color = On + +[mail function] +SMTP = localhost +smtp_port = 25 +mail.add_x_header = Off +mail.mixed_lf_and_crlf = Off + +[MySQLi] +mysqli.max_persistent = -1 +mysqli.allow_persistent = On +mysqli.max_links = -1 +mysqli.default_port = 3306 +mysqli.default_socket = +mysqli.default_host = +mysqli.default_user = +mysqli.default_pw = + +[PostgreSQL] +pgsql.allow_persistent = On +pgsql.auto_reset_persistent = Off +pgsql.max_persistent = -1 +pgsql.max_links = -1 +pgsql.ignore_notice = 0 +pgsql.log_notice = 0 + +[Session] +session.save_handler = files +session.use_strict_mode = 0 +session.use_cookies = 1 +session.use_only_cookies = 1 +session.name = PHPSESSID +session.auto_start = 0 +session.cookie_lifetime = 0 +session.cookie_path = / +session.cookie_domain = +session.cookie_httponly = +session.cookie_samesite = +session.serialize_handler = php +session.gc_probability = 1 +session.gc_divisor = 1000 +session.gc_maxlifetime = 1440 +session.referer_check = +session.cache_limiter = nocache +session.cache_expire = 180 +session.use_trans_sid = 0 +session.sid_length = 26 +session.trans_sid_tags = "a=href,area=href,frame=src,form=" +session.sid_bits_per_character = 5 + +[opcache] +opcache.enable=1 +opcache.enable_cli=1 +opcache.memory_consumption=128 +opcache.interned_strings_buffer=8 +opcache.max_accelerated_files=4000 +opcache.revalidate_freq=2 + diff --git a/alpine/nginx/docker-compose.yaml b/alpine/nginx/docker-compose.yaml new file mode 100644 index 0000000..41e219a --- /dev/null +++ b/alpine/nginx/docker-compose.yaml @@ -0,0 +1,30 @@ +services: + + # MYSQL database service + dc_db: + image: mariadb:latest + container_name: dotcleardb + restart: always + command: --transaction-isolation=READ-COMMITTED --log-bin=binlog --binlog-format=ROW + volumes: + - dc_db:/var/lib/mysql + environment: + MYSQL_ROOT_PASSWORD: dotclear_root + MYSQL_DATABASE: dotclear_db + MYSQL_USER: dotclear_user + MYSQL_PASSWORD: dotclear_pwd + + # PHP-FPM Service + dc_app: + image: jcpd/docker-dotclear:2.31-anf + container_name: dotclearphp + volumes: + - dc_app:/var/www/html + ports: + - 8080:80 + depends_on: + - dc_db # MYSQL database service + +volumes: + dc_app: # NGINX volume + dc_db: # MYSQL volume \ No newline at end of file diff --git a/alpine/nginx/latest/Dockerfile b/alpine/nginx/latest/Dockerfile new file mode 100644 index 0000000..7924ef0 --- /dev/null +++ b/alpine/nginx/latest/Dockerfile @@ -0,0 +1,87 @@ +# docker-dotclear:latest + +## +# Alpine +## + +FROM alpine:latest + +RUN echo "UTC" > /etc/timezone + +## +# Nginx +## + +RUN adduser -D -g 'www' www +RUN apk add --no-cache --update \ + nginx \ + curl \ + tar \ + unzip + +RUN mkdir -p /var/www/html \ + && chown -R www:www /var/lib/nginx \ + && chown -R www:www /var/www + +COPY nginx.conf /etc/nginx/nginx.conf + +WORKDIR /var/www/html + +## +# PHP +## + +ENV VER_PHP php83 + +RUN apk add --no-cache --update \ + ${VER_PHP}-common \ + ${VER_PHP}-cli \ + ${VER_PHP}-fpm \ + ${VER_PHP}-session \ + ${VER_PHP}-curl \ + ${VER_PHP}-gd \ + ${VER_PHP}-gmp \ + ${VER_PHP}-exif \ + ${VER_PHP}-tidy \ + ${VER_PHP}-intl \ + ${VER_PHP}-json \ + ${VER_PHP}-mbstring \ + ${VER_PHP}-iconv \ + ${VER_PHP}-gettext \ + ${VER_PHP}-mysqli \ + ${VER_PHP}-opcache \ + ${VER_PHP}-dom \ + ${VER_PHP}-xml \ + ${VER_PHP}-simplexml \ + ${VER_PHP}-zip \ + ${VER_PHP}-sqlite3 + +COPY php.ini /etc/${VER_PHP}/php.ini +COPY php-fpm.conf /etc/${VER_PHP}/php-fpm.d/www.conf + +## +# Dotclear +## + +ENV VER_DOTCLEAR 2.31 +ENV MD5_DOTCLEAR ec08bbcee14132ac7bcefb8ce5d415ed + +RUN mkdir -p /usr/src/dotclear \ + && curl -fsSL -o dotclear.zip "http://download.dotclear.org/attic/dotclear-${VER_DOTCLEAR}.zip" \ + && echo "$MD5_DOTCLEAR dotclear.zip" | md5sum -c - \ + && unzip -d /usr/src dotclear.zip \ + && rm dotclear.zip \ + && chown -R www:www /usr/src/dotclear \ + && chmod -R 755 /usr/src/dotclear/public /usr/src/dotclear/cache \ + && rm -f /var/www/html/* + +## +# END +## + +EXPOSE 80 + +ADD docker-entrypoint.sh /entrypoint.sh +ENTRYPOINT ["/bin/sh", "/entrypoint.sh"] + +HEALTHCHECK --timeout=10s CMD curl --silent --fail http://127.0.0.1:80/fpm-ping || exit 1 \ No newline at end of file diff --git a/debian/nginx/latest/docker-compose.yaml b/alpine/nginx/latest/docker-compose.yaml similarity index 67% rename from debian/nginx/latest/docker-compose.yaml rename to alpine/nginx/latest/docker-compose.yaml index b04ff11..22ae7d8 100644 --- a/debian/nginx/latest/docker-compose.yaml +++ b/alpine/nginx/latest/docker-compose.yaml @@ -1,8 +1,9 @@ # docker-dotclear:latest + services: dc_app: build: context: . dockerfile: Dockerfile - image: docker-dotclear:latest # debian nginx php-fpm + image: docker-dotclear:latest container_name: dotclear \ No newline at end of file diff --git a/debian/nginx/latest/docker-entrypoint.sh b/alpine/nginx/latest/docker-entrypoint.sh similarity index 50% rename from debian/nginx/latest/docker-entrypoint.sh rename to alpine/nginx/latest/docker-entrypoint.sh index 1479146..bf204de 100644 --- a/debian/nginx/latest/docker-entrypoint.sh +++ b/alpine/nginx/latest/docker-entrypoint.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh # docker-dotclear:latest @@ -10,34 +10,34 @@ if ! [ -e index.php -a -e src/App.php ]; then echo >&2 "Dotclear not found in $(pwd) - copying now..." if [ "$(ls -A)" ]; then echo >&2 "WARNING: $(pwd) is not empty - press Ctrl+C now if this is an error!" - ( set -x; ls -A; sleep 10 ) + ( set -x; ls -A; sleep 5 ) fi + echo >&2 "Copying Dotclear files..." tar cf - --one-file-system -C /usr/src/dotclear . | tar xf - echo >&2 "Complete! Dotclear has been successfully copied to $(pwd)" else echo >&2 "Dotclear found in $(pwd), checking upgrade..." # Check if Dotclear needs upgrade - DOTCLEAR_CURRENT_VERSION=$(sed -n "s/^\s*\"release_version\":\s*\"\(.*\)\",/\1/p" release.json) - if [ "$DOTCLEAR_CURRENT_VERSION" != "$DOTCLEAR_VERSION" ]; then - echo >&2 "Upgrading Dotclear files from ${DOTCLEAR_CURRENT_VERSION} to ${DOTCLEAR_VERSION}, please wait..." + VER_CURRENT=$(sed -n "s/^\s*\"release_version\":\s*\"\(.*\)\",/\1/p" release.json) + if [ "$VER_CURRENT" != "$VER_DOTCLEAR" ]; then + echo >&2 "Upgrading Dotclear files from ${VER_CURRENT} to ${VER_DOTCLEAR}, please wait..." tar cf - --one-file-system -C /usr/src/dotclear . | tar xf - - echo >&2 "Complete! Dotclear files have been successfully upgraded to ${DOTCLEAR_VERSION}" + echo >&2 "Complete! Dotclear files have been successfully upgraded to ${VER_DOTCLEAR}" else - echo >&2 "No need to upgrade Dotclear ${DOTCLEAR_VERSION}" + echo >&2 "No need to upgrade Dotclear ${VER_DOTCLEAR}" fi fi # Permissions -chown -R www-data:www-data /var/www/html +echo >&2 "Setting up permissions..." +chown -R www:www /var/www/html # Summary -echo >&2 "Starting services..." -echo >&2 "Debian $(cat /etc/debian_version)" -echo >&2 "$(nginx -v)PHP: $(php -r "echo PHP_VERSION;")" -echo >&2 "Dotclear: ${DOTCLEAR_VERSION}" +echo >&2 "Alpine $(cat /etc/alpine-release)" +echo >&2 "$(nginx -v)PHP $(php -r "echo PHP_VERSION;")" +echo >&2 "Dotclear: ${VER_DOTCLEAR}" -# Start services (in right order) -php-fpm -D -nginx -g 'daemon off;' +php-fpm83 -D # FPM must start first in daemon mode +nginx # Then nginx in no daemon mode exec "$@" \ No newline at end of file diff --git a/alpine/nginx/latest/nginx.conf b/alpine/nginx/latest/nginx.conf new file mode 100644 index 0000000..074f191 --- /dev/null +++ b/alpine/nginx/latest/nginx.conf @@ -0,0 +1,67 @@ +; docker-dotclear:latest + +user www; +daemon off; +worker_processes auto; +error_log /dev/stderr notice; +pid /var/run/nginx/nginx.pid; + +events { + worker_connections 1024; +} + +http { + include /etc/nginx/mime.types; + default_type application/octet-stream; + sendfile on; + #access_log /var/log/nginx/access.log; + keepalive_timeout 3000; + + server { + listen 80; + root /var/www/html; + index index.php index.html; + server_name localhost; + client_max_body_size 32m; + #error_page 500 502 503 504 /50x.html; + + location ~ ^/(db|cache|plugins|inc) { + deny all; + return 404; + } + + location / { + try_files $uri $uri/ @dotclear_path_info; + } + + location @dotclear_path_info { + rewrite ^/(.*) /index.php/$1 last; + } + + location ~ [^/]\.php(/|$) { + fastcgi_split_path_info ^(.+?\.php)(/.*)$; + if (!-f $document_root$fastcgi_script_name) { + return 404; + } + + include fastcgi_params; + set $path_info $fastcgi_path_info; + fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; + fastcgi_param PATH_INFO $fastcgi_path_info; + fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info; + + #fastcgi_pass 127.0.0.1:9000; + fastcgi_pass unix:/run/php-fpm.sock; + fastcgi_index index.php; + } + + location ~ ^/(fpm-ping)$ { + access_log off; + allow 127.0.0.1; + deny all; + fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; + include fastcgi_params; + fastcgi_pass unix:/run/php-fpm.sock; + } + } +} \ No newline at end of file diff --git a/alpine/nginx/latest/php-fpm.conf b/alpine/nginx/latest/php-fpm.conf new file mode 100644 index 0000000..f62e7e2 --- /dev/null +++ b/alpine/nginx/latest/php-fpm.conf @@ -0,0 +1,21 @@ +; docker-dotclear:latest + +[global] +error_log = /dev/stderr +pid = /var/run/php-fpm.pid + +[www] +user = www +group = www +listen = /run/php-fpm.sock +listen.owner = www +listen.group = www +listen.mode = 0660 +pm = ondemand +pm.max_children = 100 +pm.process_idle_timeout = 10s; +pm.max_requests = 1000 +ping.path = /fpm-ping +catch_workers_output = yes +decorate_workers_output = no +clear_env = no diff --git a/alpine/nginx/latest/php.ini b/alpine/nginx/latest/php.ini new file mode 100644 index 0000000..4c8f33e --- /dev/null +++ b/alpine/nginx/latest/php.ini @@ -0,0 +1,116 @@ +; docker-dotclear:latest + +[PHP] + +engine = On +short_open_tag = Off +precision = 14 +output_buffering = 4096 +zlib.output_compression = Off +implicit_flush = Off +unserialize_callback_func = +serialize_precision = -1 +disable_functions = +disable_classes = +zend.enable_gc = On +zend.exception_ignore_args = On +zend.exception_string_param_max_len = 0 + +expose_php = On + +max_execution_time = 30 +max_input_time = 60 +memory_limit = 512M +max_input_vars = 1500 + +error_reporting = E_COMPILE_ERROR|E_RECOVERABLE_ERROR|E_ERROR|E_CORE_ERROR +display_errors = On +display_startup_errors = On +log_errors = On +ignore_repeated_errors = Off +ignore_repeated_source = Off +report_memleaks = On +error_log = /dev/stderr + +variables_order = "GPCS" +request_order = "GP" +register_argc_argv = Off +auto_globals_jit = On +post_max_size = 100M +auto_prepend_file = +auto_append_file = +default_mimetype = "text/html" +default_charset = "UTF-8" + +include_path = ".:/usr/share/php83" +doc_root = +user_dir = +enable_dl = Off + +file_uploads = On +upload_max_filesize = 50M +max_file_uploads = 200 + +allow_url_fopen = On +allow_url_include = Off +default_socket_timeout = 60 + +[CLI Server] +cli_server.color = On + +[mail function] +SMTP = localhost +smtp_port = 25 +mail.add_x_header = Off +mail.mixed_lf_and_crlf = Off + +[MySQLi] +mysqli.max_persistent = -1 +mysqli.allow_persistent = On +mysqli.max_links = -1 +mysqli.default_port = 3306 +mysqli.default_socket = +mysqli.default_host = +mysqli.default_user = +mysqli.default_pw = + +[PostgreSQL] +pgsql.allow_persistent = On +pgsql.auto_reset_persistent = Off +pgsql.max_persistent = -1 +pgsql.max_links = -1 +pgsql.ignore_notice = 0 +pgsql.log_notice = 0 + +[Session] +session.save_handler = files +session.use_strict_mode = 0 +session.use_cookies = 1 +session.use_only_cookies = 1 +session.name = PHPSESSID +session.auto_start = 0 +session.cookie_lifetime = 0 +session.cookie_path = / +session.cookie_domain = +session.cookie_httponly = +session.cookie_samesite = +session.serialize_handler = php +session.gc_probability = 1 +session.gc_divisor = 1000 +session.gc_maxlifetime = 1440 +session.referer_check = +session.cache_limiter = nocache +session.cache_expire = 180 +session.use_trans_sid = 0 +session.sid_length = 26 +session.trans_sid_tags = "a=href,area=href,frame=src,form=" +session.sid_bits_per_character = 5 + +[opcache] +opcache.enable=1 +opcache.enable_cli=1 +opcache.memory_consumption=128 +opcache.interned_strings_buffer=8 +opcache.max_accelerated_files=4000 +opcache.revalidate_freq=2 + diff --git a/debian/nginx/docker-compose.yaml b/debian/nginx/docker-compose.yaml index 6f205d8..b20ce9e 100644 --- a/debian/nginx/docker-compose.yaml +++ b/debian/nginx/docker-compose.yaml @@ -16,7 +16,7 @@ services: # PHP-FPM Service dc_app: - image: jcpd/docker-dotclear:latest + image: jcpd/docker-dotclear:2.31-dnf container_name: dotclearphp volumes: - dc_app:/var/www/html diff --git a/debian/nginx/latest/Dockerfile b/debian/nginx/latest/Dockerfile deleted file mode 100644 index ca9595e..0000000 --- a/debian/nginx/latest/Dockerfile +++ /dev/null @@ -1,62 +0,0 @@ -# docker-dotclear:latest -# Debian 12.7 / nginx 1.22.1 / php-fpm 8.3 - -# Base from PHP official FPM image -FROM php:8.3-fpm - -# Dotclear version -ENV DOTCLEAR_VERSION 2.31 -ENV DOTCLEAR_MD5 ec08bbcee14132ac7bcefb8ce5d415ed - -# Required system packages -RUN set -x; \ - apt-get update \ - && apt-get install -y nginx \ - && apt-get install -y --no-install-recommends \ - postgresql-server-dev-all \ - libfreetype6-dev \ - libjpeg62-turbo-dev \ - libpng-dev \ - libonig-dev \ - rsync \ - unzip \ - && rm -r /var/lib/apt/lists/* - -# Required php packages -RUN docker-php-ext-install opcache mbstring pgsql mysqli \ - && docker-php-ext-configure gd --with-freetype --with-jpeg \ - && docker-php-ext-install gd - -# Opcache -RUN { \ - echo 'opcache.memory_consumption=128'; \ - echo 'opcache.interned_strings_buffer=8'; \ - echo 'opcache.max_accelerated_files=4000'; \ - echo 'opcache.revalidate_freq=2'; \ - echo 'opcache.fast_shutdown=1'; \ - echo 'opcache.enable_cli=1'; \ - } > /usr/local/etc/php/conf.d/php-opocache-cfg.ini - -# Web server configuartion -RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini" -COPY server.conf /etc/nginx/conf.d/default.conf - -WORKDIR /var/www/html -EXPOSE 80 - -# Get Dotclear -RUN mkdir -p /usr/src/dotclear \ - && curl -fsSL -o dotclear.zip "http://download.dotclear.org/attic/dotclear-${DOTCLEAR_VERSION}.zip" \ - && echo "$DOTCLEAR_MD5 dotclear.zip" | md5sum -c - \ - && unzip -d /usr/src dotclear.zip \ - && rm dotclear.zip \ - && chown -R www-data:www-data /usr/src/dotclear \ - && chmod -R 755 /usr/src/dotclear/public /usr/src/dotclear/cache \ - && rm -f /var/www/html/* - -# Entrypoint -ADD ../docker-entrypoint.sh /entrypoint.sh -ENTRYPOINT ["/entrypoint.sh"] - -# Container healthcheck -HEALTHCHECK --timeout=10s CMD curl --silent --fail http://127.0.0.1:8080/fpm-ping || exit 1 \ No newline at end of file diff --git a/debian/nginx/latest/server.conf b/debian/nginx/latest/server.conf deleted file mode 100644 index f1cdc71..0000000 --- a/debian/nginx/latest/server.conf +++ /dev/null @@ -1,37 +0,0 @@ -# docker-dotclear:latest -# nginx php-fpm server configuration to rewrite Dotclear's URL -server { - listen 80; - server_name localhost; - root /var/www/html; - - index index.php; - - location ~ ^/(db|cache|plugins|inc) { - deny all; - return 404; - } - - location / { - try_files $uri $uri/ @dotclear_path_info; - } - - location @dotclear_path_info { - rewrite ^/(.*) /index.php/$1 last; - } - - location ~ [^/]\.php(/|$) { - fastcgi_split_path_info ^(.+?\.php)(/.*)$; - if (!-f $document_root$fastcgi_script_name) { - return 404; - } - - include fastcgi_params; - fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; - fastcgi_param PATH_INFO $fastcgi_path_info; - fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info; - - fastcgi_pass 127.0.0.1:9000; - fastcgi_index index.php; - } -} \ No newline at end of file