Skip to content

Commit 1eb06f4

Browse files
committed
Add 8.3
1 parent b957bd5 commit 1eb06f4

27 files changed

+871
-22
lines changed

.github/workflows/ci-cd.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212

1313
strategy:
1414
matrix:
15-
version: ['8.0', '8.1', '8.2']
15+
version: ['8.0', '8.1', '8.2', '8.3']
1616
type: ['', '-prod']
1717

1818
steps:

8.0-prod/Dockerfile

+2-3
Original file line numberDiff line numberDiff line change
@@ -55,15 +55,14 @@ RUN adduser -D -u 1337 kool \
5555
zip \
5656
sockets \
5757
mysqli \
58-
&& pecl install imagick redis \
58+
&& pecl install redis \
59+
&& pecl install imagick \
5960
&& docker-php-ext-enable imagick \
6061
&& docker-php-ext-enable redis \
6162
&& cp "/usr/local/etc/php/php.ini-production" "/usr/local/etc/php/php.ini" \
6263
# composer
6364
&& curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer \
6465
&& curl -sS https://getcomposer.org/installer | php -- --1 --install-dir=/usr/local/bin --filename=composer1 \
65-
# symlink composer2 for BC
66-
&& ln -s /usr/local/bin/composer /usr/local/bin/composer2 \
6766
# cleanup
6867
&& apk del .build-deps \
6968
&& rm -rf /var/cache/apk/* /tmp/*

8.0/Dockerfile

+2-3
Original file line numberDiff line numberDiff line change
@@ -55,17 +55,16 @@ RUN adduser -D -u 1337 kool \
5555
zip \
5656
sockets \
5757
mysqli \
58-
&& pecl install imagick redis \
58+
&& pecl install redis \
5959
&& pecl install xdebug \
6060
&& pecl install pcov && docker-php-ext-enable pcov \
61+
&& pecl install imagick \
6162
&& docker-php-ext-enable imagick \
6263
&& docker-php-ext-enable redis \
6364
&& cp "/usr/local/etc/php/php.ini-development" "/usr/local/etc/php/php.ini" \
6465
# composer
6566
&& curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer \
6667
&& curl -sS https://getcomposer.org/installer | php -- --1 --install-dir=/usr/local/bin --filename=composer1 \
67-
# symlink composer2 for BC
68-
&& ln -s /usr/local/bin/composer /usr/local/bin/composer2 \
6968
# cleanup
7069
&& apk del .build-deps \
7170
&& rm -rf /var/cache/apk/* /tmp/*

8.1-prod/Dockerfile

+2-3
Original file line numberDiff line numberDiff line change
@@ -55,15 +55,14 @@ RUN adduser -D -u 1337 kool \
5555
zip \
5656
sockets \
5757
mysqli \
58-
&& pecl install imagick redis \
58+
&& pecl install redis \
59+
&& pecl install imagick \
5960
&& docker-php-ext-enable imagick \
6061
&& docker-php-ext-enable redis \
6162
&& cp "/usr/local/etc/php/php.ini-production" "/usr/local/etc/php/php.ini" \
6263
# composer
6364
&& curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer \
6465
&& curl -sS https://getcomposer.org/installer | php -- --1 --install-dir=/usr/local/bin --filename=composer1 \
65-
# symlink composer2 for BC
66-
&& ln -s /usr/local/bin/composer /usr/local/bin/composer2 \
6766
# cleanup
6867
&& apk del .build-deps \
6968
&& rm -rf /var/cache/apk/* /tmp/*

8.1/Dockerfile

+2-3
Original file line numberDiff line numberDiff line change
@@ -55,17 +55,16 @@ RUN adduser -D -u 1337 kool \
5555
zip \
5656
sockets \
5757
mysqli \
58-
&& pecl install imagick redis \
58+
&& pecl install redis \
5959
&& pecl install xdebug \
6060
&& pecl install pcov && docker-php-ext-enable pcov \
61+
&& pecl install imagick \
6162
&& docker-php-ext-enable imagick \
6263
&& docker-php-ext-enable redis \
6364
&& cp "/usr/local/etc/php/php.ini-development" "/usr/local/etc/php/php.ini" \
6465
# composer
6566
&& curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer \
6667
&& curl -sS https://getcomposer.org/installer | php -- --1 --install-dir=/usr/local/bin --filename=composer1 \
67-
# symlink composer2 for BC
68-
&& ln -s /usr/local/bin/composer /usr/local/bin/composer2 \
6968
# cleanup
7069
&& apk del .build-deps \
7170
&& rm -rf /var/cache/apk/* /tmp/*

8.2-prod/Dockerfile

+2-3
Original file line numberDiff line numberDiff line change
@@ -55,15 +55,14 @@ RUN adduser -D -u 1337 kool \
5555
zip \
5656
sockets \
5757
mysqli \
58-
&& pecl install imagick redis \
58+
&& pecl install redis \
59+
&& pecl install imagick \
5960
&& docker-php-ext-enable imagick \
6061
&& docker-php-ext-enable redis \
6162
&& cp "/usr/local/etc/php/php.ini-production" "/usr/local/etc/php/php.ini" \
6263
# composer
6364
&& curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer \
6465
&& curl -sS https://getcomposer.org/installer | php -- --1 --install-dir=/usr/local/bin --filename=composer1 \
65-
# symlink composer2 for BC
66-
&& ln -s /usr/local/bin/composer /usr/local/bin/composer2 \
6766
# cleanup
6867
&& apk del .build-deps \
6968
&& rm -rf /var/cache/apk/* /tmp/*

8.2/Dockerfile

+2-3
Original file line numberDiff line numberDiff line change
@@ -55,17 +55,16 @@ RUN adduser -D -u 1337 kool \
5555
zip \
5656
sockets \
5757
mysqli \
58-
&& pecl install imagick redis \
58+
&& pecl install redis \
5959
&& pecl install xdebug \
6060
&& pecl install pcov && docker-php-ext-enable pcov \
61+
&& pecl install imagick \
6162
&& docker-php-ext-enable imagick \
6263
&& docker-php-ext-enable redis \
6364
&& cp "/usr/local/etc/php/php.ini-development" "/usr/local/etc/php/php.ini" \
6465
# composer
6566
&& curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer \
6667
&& curl -sS https://getcomposer.org/installer | php -- --1 --install-dir=/usr/local/bin --filename=composer1 \
67-
# symlink composer2 for BC
68-
&& ln -s /usr/local/bin/composer /usr/local/bin/composer2 \
6968
# cleanup
7069
&& apk del .build-deps \
7170
&& rm -rf /var/cache/apk/* /tmp/*

8.3-nginx-prod/Dockerfile

+62
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
FROM debian AS cert
2+
3+
WORKDIR /kool/ssl
4+
5+
RUN apt-get update && \
6+
apt-get install -y openssl && \
7+
openssl genrsa -des3 -passout pass:x -out server.pass.key 2048 && \
8+
openssl rsa -passin pass:x -in server.pass.key -out _.localhost.key && \
9+
rm server.pass.key && \
10+
openssl req -new -key _.localhost.key -out server.csr \
11+
-subj "/C=XX/ST=XX/L=XX/O=Kool-Local/OU=Localhost/CN=*.localhost" && \
12+
openssl x509 -req -days 365 -in server.csr -signkey _.localhost.key -out _.localhost.crt && \
13+
openssl x509 -in _.localhost.crt -out _.localhost.pem
14+
15+
FROM kooldev/php:8.3-prod
16+
17+
ENV PHP_FPM_LISTEN=/run/php-fpm.sock \
18+
NGINX_LISTEN=80 \
19+
NGINX_HTTPS=false \
20+
NGINX_LISTEN_HTTPS=443 \
21+
NGINX_HTTPS_CERT=/kool/ssl/_.localhost.pem \
22+
NGINX_HTTPS_CERT_KEY=/kool/ssl/_.localhost.key \
23+
NGINX_ROOT=/app/public \
24+
NGINX_INDEX=index.php \
25+
NGINX_CLIENT_MAX_BODY_SIZE=25M \
26+
NGINX_PHP_FPM=unix:/run/php-fpm.sock \
27+
NGINX_FASTCGI_READ_TIMEOUT=60s \
28+
NGINX_FASTCGI_BUFFERS='8 8k' \
29+
NGINX_FASTCGI_BUFFER_SIZE='16k' \
30+
NGINX_ENTRYPOINT_WORKER_PROCESSES_AUTOTUNE=true
31+
32+
RUN curl -L https://github.com/ochinchina/supervisord/releases/download/v0.6.3/supervisord_static_0.6.3_linux_amd64 -o /usr/local/bin/supervisord \
33+
&& chmod +x /usr/local/bin/supervisord \
34+
&& apk add --no-cache nginx \
35+
&& chown -R kool:kool /var/lib/nginx \
36+
&& chmod 770 /var/lib/nginx/tmp \
37+
&& ln -sf /dev/stdout /var/log/nginx/access.log \
38+
&& ln -sf /dev/stderr /var/log/nginx/error.log \
39+
# add h5bp/server-configs-nginx
40+
&& mkdir -p /etc/nginx/conf.d \
41+
&& mkdir /etc/nginx/h5bp \
42+
&& cd /etc/nginx/h5bp \
43+
&& wget https://github.com/h5bp/server-configs-nginx/archive/refs/tags/3.3.0.tar.gz -O h5bp.tgz \
44+
&& tar xzvf h5bp.tgz \
45+
&& rm -f h5bp.tgz \
46+
&& mv server-configs-nginx-*/h5bp/* . \
47+
&& mv server-configs-nginx-*/nginx.conf /etc/nginx/nginx.conf \
48+
&& sed -i "s|^user .*|user\ kool kool;|g" /etc/nginx/nginx.conf \
49+
&& mv server-configs-nginx-*/mime.types /etc/nginx/mime.types \
50+
&& rm -rf server-configs-nginx-* \
51+
&& curl -L https://raw.githubusercontent.com/nginxinc/docker-nginx/master/entrypoint/30-tune-worker-processes.sh -o /kool/30-tune-worker-processes.sh \
52+
&& chmod +x /kool/30-tune-worker-processes.sh
53+
54+
COPY supervisor.conf /kool/supervisor.conf
55+
COPY default.tmpl /kool/default.tmpl
56+
COPY entrypoint /kool/entrypoint
57+
COPY --from=cert /kool/ssl /kool/ssl
58+
RUN chmod +x /kool/entrypoint
59+
60+
EXPOSE 80
61+
62+
CMD [ "supervisord", "-c", "/kool/supervisor.conf" ]

8.3-nginx-prod/default.tmpl

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
server {
2+
listen {{ .Env.NGINX_LISTEN }} default_server;
3+
server_name _;
4+
{{ if isTrue .Env.NGINX_HTTPS }}
5+
listen {{ .Env.NGINX_LISTEN_HTTPS }} ssl http2;
6+
ssl_certificate {{ .Env.NGINX_HTTPS_CERT }};
7+
ssl_certificate_key {{ .Env.NGINX_HTTPS_CERT_KEY }};
8+
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
9+
ssl_ciphers HIGH:!aNULL:!MD5;
10+
{{ end }}
11+
root {{ .Env.NGINX_ROOT }};
12+
index {{ .Env.NGINX_INDEX }};
13+
charset utf-8;
14+
15+
location = /favicon.ico { log_not_found off; access_log off; }
16+
location = /robots.txt { log_not_found off; access_log off; }
17+
18+
client_max_body_size {{ .Env.NGINX_CLIENT_MAX_BODY_SIZE }};
19+
20+
error_page 404 /index.php;
21+
22+
location / {
23+
try_files $uri $uri/ /{{ .Env.NGINX_INDEX }}?$query_string;
24+
25+
add_header X-Served-By kool.dev;
26+
}
27+
28+
location ~ \.php$ {
29+
fastcgi_buffers {{ .Env.NGINX_FASTCGI_BUFFERS }};
30+
fastcgi_buffer_size {{ .Env.NGINX_FASTCGI_BUFFER_SIZE }};
31+
fastcgi_pass {{ .Env.NGINX_PHP_FPM }};
32+
fastcgi_read_timeout {{ .Env.NGINX_FASTCGI_READ_TIMEOUT }};
33+
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
34+
include fastcgi_params;
35+
}
36+
37+
location ~ /\.ht {
38+
deny all;
39+
}
40+
41+
# good practices
42+
add_header X-Frame-Options "SAMEORIGIN";
43+
44+
# basic H5BP suggestions
45+
include h5bp/internet_explorer/x-ua-compatible.conf;
46+
include h5bp/security/referrer-policy.conf;
47+
include h5bp/security/x-content-type-options.conf;
48+
include h5bp/security/x-xss-protection.conf;
49+
50+
# performance enhancements (mostly for caching static data)
51+
include h5bp/web_performance/cache-file-descriptors.conf;
52+
include h5bp/web_performance/pre-compressed_content_gzip.conf;
53+
}

8.3-nginx-prod/entrypoint

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/bin/sh
2+
set -e
3+
4+
5+
# Run as current user
6+
CURRENT_USER=${ASUSER:-${UID:-0}}
7+
8+
if [ ! -z "$CURRENT_USER" ] && [ "$CURRENT_USER" != "0" ]; then
9+
usermod -u $CURRENT_USER kool
10+
fi
11+
12+
dockerize -template /kool/kool.tmpl:/usr/local/etc/php/conf.d/kool.ini -template /kool/zz-docker.tmpl:/usr/local/etc/php-fpm.d/zz-docker.conf -template /kool/default.tmpl:/etc/nginx/conf.d/default.conf
13+
14+
/kool/30-tune-worker-processes.sh
15+
16+
# Run entrypoint if provided
17+
if [ ! -z "$ENTRYPOINT" ] && [ -f "$ENTRYPOINT" ]; then
18+
bash $ENTRYPOINT
19+
fi
20+
21+
if [ "$1" = "sh" ] || [ "$1" = "bash" ] || [ "$1" = "php-fpm" ] || [ "$1" = "nginx" ] || [ "$1" = "supervisord" ]; then
22+
exec "$@"
23+
else
24+
exec su-exec kool "$@"
25+
fi

8.3-nginx-prod/supervisor.conf

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
[program:nginx]
2+
depends_on = php-fpm
3+
command = nginx -g "daemon off;"
4+
stopasgroup = true
5+
stderr_logfile = /dev/stderr
6+
stdout_logfile = /dev/stdout
7+
8+
[program:php-fpm]
9+
command = php-fpm
10+
stopasgroup = true
11+
stderr_logfile = /dev/stderr
12+
stdout_logfile = /dev/stdout

8.3-nginx/Dockerfile

+62
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
FROM debian AS cert
2+
3+
WORKDIR /kool/ssl
4+
5+
RUN apt-get update && \
6+
apt-get install -y openssl && \
7+
openssl genrsa -des3 -passout pass:x -out server.pass.key 2048 && \
8+
openssl rsa -passin pass:x -in server.pass.key -out _.localhost.key && \
9+
rm server.pass.key && \
10+
openssl req -new -key _.localhost.key -out server.csr \
11+
-subj "/C=XX/ST=XX/L=XX/O=Kool-Local/OU=Localhost/CN=*.localhost" && \
12+
openssl x509 -req -days 365 -in server.csr -signkey _.localhost.key -out _.localhost.crt && \
13+
openssl x509 -in _.localhost.crt -out _.localhost.pem
14+
15+
FROM kooldev/php:8.3
16+
17+
ENV PHP_FPM_LISTEN=/run/php-fpm.sock \
18+
NGINX_LISTEN=80 \
19+
NGINX_HTTPS=false \
20+
NGINX_LISTEN_HTTPS=443 \
21+
NGINX_HTTPS_CERT=/kool/ssl/_.localhost.pem \
22+
NGINX_HTTPS_CERT_KEY=/kool/ssl/_.localhost.key \
23+
NGINX_ROOT=/app/public \
24+
NGINX_INDEX=index.php \
25+
NGINX_CLIENT_MAX_BODY_SIZE=25M \
26+
NGINX_PHP_FPM=unix:/run/php-fpm.sock \
27+
NGINX_FASTCGI_READ_TIMEOUT=60s \
28+
NGINX_FASTCGI_BUFFERS='8 8k' \
29+
NGINX_FASTCGI_BUFFER_SIZE='16k' \
30+
NGINX_ENTRYPOINT_WORKER_PROCESSES_AUTOTUNE=true
31+
32+
RUN curl -L https://github.com/ochinchina/supervisord/releases/download/v0.6.3/supervisord_static_0.6.3_linux_amd64 -o /usr/local/bin/supervisord \
33+
&& chmod +x /usr/local/bin/supervisord \
34+
&& apk add --no-cache nginx \
35+
&& chown -R kool:kool /var/lib/nginx \
36+
&& chmod 770 /var/lib/nginx/tmp \
37+
&& ln -sf /dev/stdout /var/log/nginx/access.log \
38+
&& ln -sf /dev/stderr /var/log/nginx/error.log \
39+
# add h5bp/server-configs-nginx
40+
&& mkdir -p /etc/nginx/conf.d \
41+
&& mkdir /etc/nginx/h5bp \
42+
&& cd /etc/nginx/h5bp \
43+
&& wget https://github.com/h5bp/server-configs-nginx/archive/refs/tags/3.3.0.tar.gz -O h5bp.tgz \
44+
&& tar xzvf h5bp.tgz \
45+
&& rm -f h5bp.tgz \
46+
&& mv server-configs-nginx-*/h5bp/* . \
47+
&& mv server-configs-nginx-*/nginx.conf /etc/nginx/nginx.conf \
48+
&& sed -i "s|^user .*|user\ kool kool;|g" /etc/nginx/nginx.conf \
49+
&& mv server-configs-nginx-*/mime.types /etc/nginx/mime.types \
50+
&& rm -rf server-configs-nginx-* \
51+
&& curl -L https://raw.githubusercontent.com/nginxinc/docker-nginx/master/entrypoint/30-tune-worker-processes.sh -o /kool/30-tune-worker-processes.sh \
52+
&& chmod +x /kool/30-tune-worker-processes.sh
53+
54+
COPY supervisor.conf /kool/supervisor.conf
55+
COPY default.tmpl /kool/default.tmpl
56+
COPY entrypoint /kool/entrypoint
57+
COPY --from=cert /kool/ssl /kool/ssl
58+
RUN chmod +x /kool/entrypoint
59+
60+
EXPOSE 80
61+
62+
CMD [ "supervisord", "-c", "/kool/supervisor.conf" ]

8.3-nginx/default.tmpl

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
server {
2+
listen {{ .Env.NGINX_LISTEN }} default_server;
3+
server_name _;
4+
{{ if isTrue .Env.NGINX_HTTPS }}
5+
listen {{ .Env.NGINX_LISTEN_HTTPS }} ssl http2;
6+
ssl_certificate {{ .Env.NGINX_HTTPS_CERT }};
7+
ssl_certificate_key {{ .Env.NGINX_HTTPS_CERT_KEY }};
8+
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
9+
ssl_ciphers HIGH:!aNULL:!MD5;
10+
{{ end }}
11+
root {{ .Env.NGINX_ROOT }};
12+
index {{ .Env.NGINX_INDEX }};
13+
charset utf-8;
14+
15+
location = /favicon.ico { log_not_found off; access_log off; }
16+
location = /robots.txt { log_not_found off; access_log off; }
17+
18+
client_max_body_size {{ .Env.NGINX_CLIENT_MAX_BODY_SIZE }};
19+
20+
error_page 404 /index.php;
21+
22+
location / {
23+
try_files $uri $uri/ /{{ .Env.NGINX_INDEX }}?$query_string;
24+
25+
add_header X-Served-By kool.dev;
26+
}
27+
28+
location ~ \.php$ {
29+
fastcgi_buffers {{ .Env.NGINX_FASTCGI_BUFFERS }};
30+
fastcgi_buffer_size {{ .Env.NGINX_FASTCGI_BUFFER_SIZE }};
31+
fastcgi_pass {{ .Env.NGINX_PHP_FPM }};
32+
fastcgi_read_timeout {{ .Env.NGINX_FASTCGI_READ_TIMEOUT }};
33+
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
34+
include fastcgi_params;
35+
}
36+
37+
location ~ /\.ht {
38+
deny all;
39+
}
40+
41+
# good practices
42+
add_header X-Frame-Options "SAMEORIGIN";
43+
44+
# basic H5BP suggestions
45+
include h5bp/internet_explorer/x-ua-compatible.conf;
46+
include h5bp/security/referrer-policy.conf;
47+
include h5bp/security/x-content-type-options.conf;
48+
include h5bp/security/x-xss-protection.conf;
49+
50+
# performance enhancements (mostly for caching static data)
51+
include h5bp/web_performance/cache-file-descriptors.conf;
52+
include h5bp/web_performance/pre-compressed_content_gzip.conf;
53+
}

0 commit comments

Comments
 (0)