Skip to content

Commit

Permalink
Add PHP 8.3
Browse files Browse the repository at this point in the history
  • Loading branch information
f3l1x committed Feb 27, 2024
1 parent d79a4c5 commit 2332407
Show file tree
Hide file tree
Showing 17 changed files with 480 additions and 3 deletions.
1 change: 1 addition & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
Expand All @@ -37,7 +38,7 @@ docker run \
--rm \
--name www \
-p 80:80 \
dockette/web:php-82
dockette/web:php-83
```

## Custom Nginx config
Expand All @@ -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
Expand All @@ -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.
Expand Down
95 changes: 95 additions & 0 deletions debian-php-83/Dockerfile
Original file line number Diff line number Diff line change
@@ -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"]
13 changes: 13 additions & 0 deletions debian-php-83/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -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
135 changes: 135 additions & 0 deletions debian-php-83/nginx/mime.types
Original file line number Diff line number Diff line change
@@ -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;

}
89 changes: 89 additions & 0 deletions debian-php-83/nginx/nginx.conf
Original file line number Diff line number Diff line change
@@ -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/*;
}
Loading

0 comments on commit 2332407

Please sign in to comment.