diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 8b405f6..761161b 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -27,3 +27,4 @@ jobs: - { context: debian-php-80, tag: php-80 } - { context: debian-php-81, tag: php-81 } - { context: debian-php-82, tag: php-82 } + - { context: debian-php-83, tag: php-83 } diff --git a/Makefile b/Makefile index 5baa8bc..5a24b84 100644 --- a/Makefile +++ b/Makefile @@ -25,6 +25,7 @@ docker-build-php-74: _docker-build-php-74 docker-build-php-80: _docker-build-php-80 docker-build-php-81: _docker-build-php-81 docker-build-php-82: _docker-build-php-82 +docker-build-php-83: _docker-build-php-83 docker-build-all: $(MAKE) docker-build-php-70 diff --git a/README.md b/README.md index cf568e7..a5ff443 100644 --- a/README.md +++ b/README.md @@ -20,6 +20,7 @@ | Image | Distro | PHP | |-----------------------|--------|-----| +| `dockette/web:php-83` | Buster | 8.3 | | `dockette/web:php-82` | Buster | 8.2 | | `dockette/web:php-81` | Buster | 8.1 | | `dockette/web:php-80` | Buster | 8.0 | @@ -37,7 +38,7 @@ docker run \ --rm \ --name www \ -p 80:80 \ - dockette/web:php-82 + dockette/web:php-83 ``` ## Custom Nginx config @@ -52,7 +53,7 @@ docker run \ --name www \ -v my-lovely-nginx.conf:/etc/nginx/sites.d/site.conf \ -p 80:80 \ - dockette/web:php-82 + dockette/web:php-83 ``` ## Run cron tasks @@ -67,7 +68,7 @@ docker run \ --name www \ -v my-crontab:/etc/cron.d/app \ -p 80:80 \ - dockette/web:php-82 + dockette/web:php-83 ``` Please note, this crontab should has a little bit different format. diff --git a/debian-php-83/Dockerfile b/debian-php-83/Dockerfile new file mode 100644 index 0000000..3d6b4a6 --- /dev/null +++ b/debian-php-83/Dockerfile @@ -0,0 +1,95 @@ +FROM dockette/debian:buster + +# PHP +ENV PHP_MODS_DIR=/etc/php/8.3/mods-available +ENV PHP_CLI_DIR=/etc/php/8.3/cli/ +ENV PHP_CLI_CONF_DIR=${PHP_CLI_DIR}/conf.d +ENV PHP_CGI_DIR=/etc/php/8.3/cgi/ +ENV PHP_CGI_CONF_DIR=${PHP_CGI_DIR}/conf.d +ENV PHP_FPM_DIR=/etc/php/8.3/fpm/ +ENV PHP_FPM_CONF_DIR=${PHP_FPM_DIR}/conf.d +ENV PHP_FPM_POOL_DIR=${PHP_FPM_DIR}/pool.d +ENV PHP_FPM_BIN=/usr/sbin/php-fpm8.3 +ENV PHP_FPM_CONF=/etc/php/8.3/php-fpm.conf +ENV TZ=Europe/Prague + +# INSTALLATION +RUN apt update && apt dist-upgrade -y && \ + # DEPENDENCIES ############################################################# + apt install -y wget curl apt-transport-https ca-certificates gnupg2 cron && \ + # PHP DEB.SURY.CZ ########################################################## + wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg && \ + echo "deb https://packages.sury.org/php/ buster main" > /etc/apt/sources.list.d/php.list && \ + wget -O- http://nginx.org/keys/nginx_signing.key | apt-key add - && \ + echo "deb http://nginx.org/packages/debian/ buster nginx" > /etc/apt/sources.list.d/nginx.list && \ + echo "deb-src http://nginx.org/packages/debian/ buster nginx" >> /etc/apt/sources.list.d/nginx.list && \ + apt update && \ + apt install -y --no-install-recommends \ + nginx \ + supervisor \ + php8.3-apc \ + php8.3-apcu \ + php8.3-bz2 \ + php8.3-bcmath \ + php8.3-calendar \ + php8.3-cgi \ + php8.3-cli \ + php8.3-ctype \ + php8.3-curl \ + php8.3-fpm \ + php8.3-gettext \ + php8.3-gd \ + php8.3-intl \ + php8.3-imap \ + php8.3-ldap \ + php8.3-mbstring \ + php8.3-memcached \ + php8.3-mongo \ + php8.3-mysql \ + php8.3-pdo \ + php8.3-pgsql \ + php8.3-redis \ + php8.3-soap \ + php8.3-sqlite3 \ + php8.3-ssh2 \ + php8.3-tidy \ + php8.3-zip \ + php8.3-xmlrpc \ + php8.3-xsl && \ + # COMPOSER ################################################################# + curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer --2 && \ + # NGINX #################################################################### + ln -sf /dev/stdout /var/log/nginx/access.log && \ + ln -sf /dev/stderr /var/log/nginx/error.log && \ + # CLEAN UP ################################################################# + rm /etc/nginx/conf.d/default.conf && \ + apt-get clean -y && \ + apt-get autoclean -y && \ + apt-get remove -y wget && \ + apt-get autoremove -y && \ + rm -rf /var/lib/apt/lists/* /var/lib/log/* /tmp/* /var/tmp/* + +# PHP +ADD ./php/php-fpm.conf /etc/php/8.3/ +ADD ./php/php.ini /etc/php/8.3/conf.d/ + +# NGINX +ADD ./nginx/nginx.conf /etc/nginx/ +ADD ./nginx/mime.types /etc/nginx/ +ADD ./nginx/sites.d /etc/nginx/sites.d + +# WWW +ADD ./www /srv/www/ + +# SUPERVISOR +ADD ./supervisor/supervisord.conf /etc/supervisor/ +ADD ./supervisor/services /etc/supervisor/conf.d/ + +# APPLICATION +WORKDIR /srv + +# PORTS +EXPOSE 80 +COPY entrypoint.sh /usr/sbin/entrypoint.sh +RUN chmod +x /usr/sbin/entrypoint.sh +CMD ["/usr/sbin/entrypoint.sh"] diff --git a/debian-php-83/entrypoint.sh b/debian-php-83/entrypoint.sh new file mode 100755 index 0000000..98a47c0 --- /dev/null +++ b/debian-php-83/entrypoint.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +# loop through all the environment variables and append them to /etc/environment +# because cron doesn't "see" docker environment variables +echo -n > /etc/environment +while IFS='=' read -r key value; do + if [[ ! -z "$key" && ! -z "$value" ]]; then + echo "$key=\"$value\"" >> /etc/environment + fi +done < <(printenv) + +# run supervisord +supervisord --nodaemon --configuration /etc/supervisor/supervisord.conf diff --git a/debian-php-83/nginx/mime.types b/debian-php-83/nginx/mime.types new file mode 100755 index 0000000..fbeb077 --- /dev/null +++ b/debian-php-83/nginx/mime.types @@ -0,0 +1,135 @@ +types { + + # Data interchange + + application/atom+xml atom; + application/json json map topojson; + application/ld+json jsonld; + application/rss+xml rss; + application/vnd.geo+json geojson; + application/xml rdf xml; + + + # JavaScript + + # Normalize to standard type. + # https://tools.ietf.org/html/rfc4329#section-7.2 + application/javascript js; + + + # Manifest files + + application/manifest+json webmanifest; + application/x-web-app-manifest+json webapp; + text/cache-manifest appcache; + + + # Media files + + audio/midi mid midi kar; + audio/mp4 aac f4a f4b m4a; + audio/mpeg mp3; + audio/ogg oga ogg opus; + audio/x-realaudio ra; + audio/x-wav wav; + image/bmp bmp; + image/gif gif; + image/jpeg jpeg jpg; + image/png png; + image/svg+xml svg svgz; + image/tiff tif tiff; + image/vnd.wap.wbmp wbmp; + image/webp webp; + image/x-jng jng; + video/3gpp 3gp 3gpp; + video/mp4 f4p f4v m4v mp4; + video/mpeg mpeg mpg; + video/ogg ogv; + video/quicktime mov; + video/webm webm; + video/x-flv flv; + video/x-mng mng; + video/x-ms-asf asf asx; + video/x-ms-wmv wmv; + video/x-msvideo avi; + + # Serving `.ico` image files with a different media type + # prevents Internet Explorer from displaying then as images: + # https://github.com/h5bp/html5-boilerplate/commit/37b5fec090d00f38de64b591bcddcb205aadf8ee + + image/x-icon cur ico; + + + # Microsoft Office + + application/msword doc; + application/vnd.ms-excel xls; + application/vnd.ms-powerpoint ppt; + application/vnd.openxmlformats-officedocument.wordprocessingml.document docx; + application/vnd.openxmlformats-officedocument.spreadsheetml.sheet xlsx; + application/vnd.openxmlformats-officedocument.presentationml.presentation pptx; + + + # Web fonts + + application/font-woff woff; + application/font-woff2 woff2; + application/vnd.ms-fontobject eot; + + # Browsers usually ignore the font media types and simply sniff + # the bytes to figure out the font type. + # https://mimesniff.spec.whatwg.org/#matching-a-font-type-pattern + # + # However, Blink and WebKit based browsers will show a warning + # in the console if the following font types are served with any + # other media types. + + application/x-font-ttf ttc ttf; + font/opentype otf; + + + # Other + + application/java-archive ear jar war; + application/mac-binhex40 hqx; + application/octet-stream bin deb dll dmg exe img iso msi msm msp safariextz; + application/pdf pdf; + application/postscript ai eps ps; + application/rtf rtf; + application/vnd.google-earth.kml+xml kml; + application/vnd.google-earth.kmz kmz; + application/vnd.wap.wmlc wmlc; + application/x-7z-compressed 7z; + application/x-bb-appworld bbaw; + application/x-bittorrent torrent; + application/x-chrome-extension crx; + application/x-cocoa cco; + application/x-java-archive-diff jardiff; + application/x-java-jnlp-file jnlp; + application/x-makeself run; + application/x-opera-extension oex; + application/x-perl pl pm; + application/x-pilot pdb prc; + application/x-rar-compressed rar; + application/x-redhat-package-manager rpm; + application/x-sea sea; + application/x-shockwave-flash swf; + application/x-stuffit sit; + application/x-tcl tcl tk; + application/x-x509-ca-cert crt der pem; + application/x-xpinstall xpi; + application/xhtml+xml xhtml; + application/xslt+xml xsl; + application/zip zip; + text/css css; + text/html htm html shtml; + text/mathml mml; + text/plain txt; + text/vcard vcard vcf; + text/vnd.rim.location.xloc xloc; + text/vnd.sun.j2me.app-descriptor jad; + text/vnd.wap.wml wml; + text/vtt vtt; + text/x-component htc; + +} \ No newline at end of file diff --git a/debian-php-83/nginx/nginx.conf b/debian-php-83/nginx/nginx.conf new file mode 100755 index 0000000..dce759b --- /dev/null +++ b/debian-php-83/nginx/nginx.conf @@ -0,0 +1,89 @@ +user www-data; +worker_processes auto; +worker_rlimit_nofile 8192; + +pid /var/run/nginx.pid; + +events { + worker_connections 8000; +} + +http { + + ## + # Basic Settings + ## + + sendfile on; + tcp_nopush on; + tcp_nodelay on; + types_hash_max_size 2048; + server_tokens off; + + client_max_body_size 128M; + + # server_names_hash_bucket_size 64; + # server_name_in_redirect off; + + ## + # Charset + ## + + include /etc/nginx/mime.types; + default_type application/octet-stream; + charset_types text/css text/plain text/vnd.wap.wml application/javascript application/json application/rss+xml application/xml; + + ## + # Logging Settings + ## + + log_format main '$remote_addr - $remote_user [$time_local] "$request" ' + '$status $body_bytes_sent "$http_referer" ' + '"$http_user_agent" "$http_x_forwarded_for"'; + + access_log /var/log/nginx/access.log; + error_log /var/log/nginx/error.log warn; + + ## + # Gzip Settings + ## + + gzip on; + gzip_disable "msie6"; + gzip_comp_level 5; + gzip_min_length 256; + gzip_proxied any; + gzip_vary on; + gzip_types + application/atom+xml + application/javascript + application/json + application/ld+json + application/manifest+json + application/rss+xml + application/vnd.geo+json + application/vnd.ms-fontobject + application/x-font-ttf + application/x-web-app-manifest+json + application/xhtml+xml + application/xml + font/opentype + image/bmp + image/svg+xml + image/x-icon + text/cache-manifest + text/css + text/plain + text/vcard + text/vnd.rim.location.xloc + text/vtt + text/x-component + text/x-cross-domain-policy; + + ## + # Virtual Host Configs + ## + + include /etc/nginx/conf.d/*.conf; + include /etc/nginx/sites.d/*; +} diff --git a/debian-php-83/nginx/sites.d/site.conf b/debian-php-83/nginx/sites.d/site.conf new file mode 100755 index 0000000..6daf2f4 --- /dev/null +++ b/debian-php-83/nginx/sites.d/site.conf @@ -0,0 +1,32 @@ +## +# Virtual Host Configs +## +upstream app { + server unix:/var/run/php-fpm.sock; +} + +server { + listen 80; + + index index.html index.php; + root /srv/www/; + + location / { + try_files $uri $uri/ /index.php$is_args$args; + } + + location ~* \.php$ { + fastcgi_split_path_info ^(.+?\.php)(/.*)$; + + fastcgi_pass app; + fastcgi_index index.php; + include fastcgi_params; + + fastcgi_param PATH_INFO $fastcgi_path_info; + fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info; + fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name; + fastcgi_param DOCUMENT_ROOT $realpath_root; + + try_files $uri =404; + } +} \ No newline at end of file diff --git a/debian-php-83/php/php-fpm.conf b/debian-php-83/php/php-fpm.conf new file mode 100755 index 0000000..78b9a06 --- /dev/null +++ b/debian-php-83/php/php-fpm.conf @@ -0,0 +1,30 @@ +[global] + +error_log = /proc/self/fd/2 +daemonize = yes + +[www] + +; if we send this to /proc/self/fd/1, it never appears +access.log = /proc/self/fd/2 + +user = www-data +group = www-data + +listen = /var/run/php-fpm.sock +listen.owner = www-data +listen.group = www-data +listen.mode = 0660 + +pm = dynamic +pm.max_children = 20 +pm.start_servers = 5 +pm.min_spare_servers = 2 +pm.max_spare_servers = 5 +pm.max_requests = 500 +catch_workers_output = yes +clear_env = no + +php_admin_value[error_log] = /var/log/php-fpm.log +php_admin_value[open_basedir]= "/tmp:/var/tmp:/var/www:/srv" +php_admin_value[upload_tmp_dir] = "/tmp" diff --git a/debian-php-83/php/php.ini b/debian-php-83/php/php.ini new file mode 100644 index 0000000..c4f4ece --- /dev/null +++ b/debian-php-83/php/php.ini @@ -0,0 +1,13 @@ +; Update memory +memory_limit = 256M +upload_max_filesize = 32M +post_max_size = 32M + +; Dates +date.timezone=Europe/Prague + +; Mailer +;sendmail_path = /usr/local/bin/phpmailer + +; No disabled functions +;disable_functions = diff --git a/debian-php-83/supervisor/services/cron.conf b/debian-php-83/supervisor/services/cron.conf new file mode 100755 index 0000000..3bbc24a --- /dev/null +++ b/debian-php-83/supervisor/services/cron.conf @@ -0,0 +1,8 @@ +[program:cron] +command = /usr/sbin/cron -f +autostart=true +autorestart=true +stdout_logfile=/dev/stdout +stdout_logfile_maxbytes=0 +stderr_logfile=/dev/stderr +stderr_logfile_maxbytes=0 diff --git a/debian-php-83/supervisor/services/nginx.conf b/debian-php-83/supervisor/services/nginx.conf new file mode 100755 index 0000000..2a3e37b --- /dev/null +++ b/debian-php-83/supervisor/services/nginx.conf @@ -0,0 +1,7 @@ +[program:nginx] +command = /usr/sbin/nginx -g "daemon off;" +autostart=true +stdout_logfile=/dev/stdout +stdout_logfile_maxbytes=0 +stderr_logfile=/dev/stderr +stderr_logfile_maxbytes=0 diff --git a/debian-php-83/supervisor/services/php-fpm.conf b/debian-php-83/supervisor/services/php-fpm.conf new file mode 100755 index 0000000..8271478 --- /dev/null +++ b/debian-php-83/supervisor/services/php-fpm.conf @@ -0,0 +1,7 @@ +[program:php-fpm] +command = %(ENV_PHP_FPM_BIN)s -F -R -y %(ENV_PHP_FPM_CONF)s +autostart=true +stdout_logfile=/dev/stdout +stdout_logfile_maxbytes=0 +stderr_logfile=/dev/stderr +stderr_logfile_maxbytes=0 diff --git a/debian-php-83/supervisor/supervisord.conf b/debian-php-83/supervisor/supervisord.conf new file mode 100755 index 0000000..97d1bb8 --- /dev/null +++ b/debian-php-83/supervisor/supervisord.conf @@ -0,0 +1,31 @@ +; See more on example documentaion. +; https://github.com/Supervisor/supervisor/blob/master/supervisor/skel/sample.conf + +[unix_http_server] +file=/var/run/supervisor.sock +chmod = 0700 +chown= nobody:nogroup +username = docker +password = loveit + +[supervisord] +logfile=/var/log/supervisor/supervisord.log +pidfile=/var/run/supervisord.pid +childlogdir=/var/log/supervisor +logfile_maxbytes = 50MB +logfile_backups=10 +loglevel = info +nodaemon = true +umask = 022 +identifier = supervisor + +[rpcinterface:supervisor] +supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface + +[supervisorctl] +serverurl=unix:///var/run/supervisor.sock +username = docker +password = loveit + +[include] +files = /etc/supervisor/conf.d/*.conf diff --git a/debian-php-83/www/dockette.png b/debian-php-83/www/dockette.png new file mode 100755 index 0000000..71593d1 Binary files /dev/null and b/debian-php-83/www/dockette.png differ diff --git a/debian-php-83/www/index.html b/debian-php-83/www/index.html new file mode 100755 index 0000000..bc30ebc --- /dev/null +++ b/debian-php-83/www/index.html @@ -0,0 +1,13 @@ + + + + Dockette + + +
+

Dockette

+

It works!

+ +
+ + \ No newline at end of file diff --git a/debian-php-83/www/phpinfo.php b/debian-php-83/www/phpinfo.php new file mode 100644 index 0000000..c4837a3 --- /dev/null +++ b/debian-php-83/www/phpinfo.php @@ -0,0 +1 @@ +