Skip to content

Commit a017abb

Browse files
author
Alcides Ramos
committed
refactor: upgrade to PHP 8.4.10
1 parent 5df7834 commit a017abb

File tree

13 files changed

+266
-261
lines changed

13 files changed

+266
-261
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
## Summary
1616

17-
This repository contains a _dockerized_ environment for building PHP applications based on **php:8.3.2-fpm-alpine** with Caddy support.
17+
This repository contains a _dockerized_ environment for building PHP applications based on **php:8.4.10-fpm-alpine** with Caddy support.
1818

1919
### Highlights
2020

docker/Dockerfile

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# STAGE: BASE-IMAGE
55
#----------------------------------------------------------
66

7-
FROM php:8.3.2-fpm-alpine AS base-image
7+
FROM php:8.4.10-fpm-alpine AS base-image
88

99
#----------------------------------------------------------
1010
# STAGE: COMMON
@@ -42,7 +42,6 @@ FROM extensions-builder-required AS extensions-builder-development
4242

4343
# Add, compile and configure PHP extensions
4444
RUN curl -sSL https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions -o - | sh -s \
45-
uopz \
4645
xdebug
4746

4847
#----------------------------------------------------------
@@ -59,7 +58,7 @@ ARG HOST_GROUP_NAME=host-groupname
5958
ENV ENV=DEVELOPMENT
6059

6160
# Add __ONLY__ compiled extensions & their config files
62-
COPY --from=extensions-builder-development /usr/local/lib/php/extensions/*/* /usr/local/lib/php/extensions/no-debug-non-zts-20230831/
61+
COPY --from=extensions-builder-development /usr/local/lib/php/extensions/*/* /usr/local/lib/php/extensions/no-debug-non-zts-20240924/
6362
COPY --from=extensions-builder-development /usr/local/etc/php/conf.d/* /usr/local/etc/php/conf.d/
6463

6564
# Add Composer from public Docker image
@@ -142,7 +141,7 @@ FROM common AS build-production
142141
ENV ENV=PRODUCTION
143142

144143
# Add __ONLY__ compiled extensions & their config files
145-
COPY --from=extensions-builder-required /usr/local/lib/php/extensions/*/* /usr/local/lib/php/extensions/no-debug-non-zts-20230831/
144+
COPY --from=extensions-builder-required /usr/local/lib/php/extensions/*/* /usr/local/lib/php/extensions/no-debug-non-zts-20240924/
146145
COPY --from=extensions-builder-required /usr/local/etc/php/conf.d/* /usr/local/etc/php/conf.d/
147146

148147
# Add the optimized for production application

docker/caddy/Caddyfile

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,13 @@
55
import snippets/*
66

77
{$CADDY_HOSTNAME} {
8-
import strip-www
8+
#import bearer-token
99
import common
10-
import cache
11-
import security
12-
import ssl
10+
import header
1311
import not-found
12+
import php-fastcgi
13+
import remove-www
14+
import ssl
1415

1516
root * /var/www/html/public
16-
17-
import php-fastcgi
1817
}

docker/caddy/snippets/bearer-token

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
(bearer-token) {
2+
@authorized {
3+
header Authorization "{$CADDY_AUTHORIZATION_METHOD} {$CADDY_AUTHORIZATION_TOKEN}"
4+
}
5+
6+
@unauthorized {
7+
not {
8+
header Authorization "{$CADDY_AUTHORIZATION_METHOD} {$CADDY_AUTHORIZATION_TOKEN}"
9+
}
10+
}
11+
12+
respond @unauthorized "Unauthorized" 401 {
13+
close
14+
}
15+
}

docker/caddy/snippets/cache

Lines changed: 0 additions & 18 deletions
This file was deleted.

docker/caddy/snippets/header

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
(header) {
2+
header {
3+
# CORS
4+
5+
Vary Origin
6+
Access-Control-Allow-Origin "{header.origin}"
7+
Access-Control-Expose-Headers "Authorization"
8+
Access-Control-Allow-Credentials "true"
9+
10+
# CACHE
11+
12+
Cache-Control "public, max-age=31536000"
13+
14+
# SECURITY
15+
16+
Strict-Transport-Security "max-age=31536000;includeSubDomains;preload"
17+
18+
Referrer-Policy "no-referrer-when-downgrade"
19+
20+
Content-Security-Policy "upgrade-insecure-requests"
21+
22+
X-Forwarded-For {http.request.remote.host}
23+
X-Content-Type-Options "nosniff"
24+
?X-Frame-Options "SAMEORIGIN"
25+
?X-XSS-Protection "1;mode=block"
26+
27+
Permissions-Policy "autoplay=(self),camera=(),geolocation=(),microphone=(),payment=(),usb=()"
28+
Feature-Policy "accelerometer 'none'; ambient-light-sensor 'none'; autoplay 'self'; camera 'none'; encrypted-media 'none'; fullscreen 'self'; geolocation 'none'; gyroscope 'none'; magnetometer 'none'; microphone 'none'; midi 'none'; payment 'none'; picture-in-picture *; speaker 'none'; sync-xhr 'none'; usb 'none'; vr 'none'"
29+
30+
-Server
31+
-X-Powered-By
32+
}
33+
34+
# SECURITY
35+
36+
@excludedMethods {
37+
not method GET HEAD POST OPTIONS
38+
}
39+
respond @excludedMethods "Not Allowed" 405 {
40+
close
41+
}
42+
43+
# CACHE
44+
45+
@static {
46+
file
47+
path *.avif *.ico *.css *.js *.gz *.eot *.ttf *.otf *.gif *.webp *.avif *.jpg *.jpeg *.png *.svg *.woff *.woff2 *.pdf
48+
}
49+
header @static Cache-Control "max-age=31536000,public,inmutable"
50+
51+
@html {
52+
path *.html *.htm
53+
}
54+
header @html {
55+
Cache-Control "public, max-age=43200"
56+
}
57+
58+
# CORS
59+
60+
@cors_preflight method OPTIONS
61+
handle @cors_preflight {
62+
header {
63+
Access-Control-Allow-Methods "GET, POST, PUT, PATCH, DELETE"
64+
Access-Control-Max-Age "3600"
65+
}
66+
respond "" 204
67+
}
68+
}

docker/caddy/snippets/remove-www

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
(remove-www) {
2+
@strip_www {
3+
header_regexp www Host ^www\.(.*)$
4+
}
5+
6+
redir @strip_www http://{http.regexp.www.1}{uri}
7+
}

docker/caddy/snippets/security

Lines changed: 0 additions & 20 deletions
This file was deleted.

docker/caddy/snippets/strip-www

Lines changed: 0 additions & 6 deletions
This file was deleted.

src/composer.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@
4545
"phpmd/phpmd": "^2.15",
4646
"phpstan/phpstan": "^1.10",
4747
"phpunit/phpunit": "^11.0",
48-
"slope-it/clock-mock": "^0.4.0",
4948
"squizlabs/php_codesniffer": "^3.9",
5049
"symfony/var-dumper": "^7.0"
5150
},

0 commit comments

Comments
 (0)