Skip to content

Commit 4729cbb

Browse files
authored
feat: add PHP 8.4 support (#4)
1 parent 7893205 commit 4729cbb

File tree

6 files changed

+130
-3
lines changed

6 files changed

+130
-3
lines changed

β€Ž.github/workflows/ci.ymlβ€Ž

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ name: Build and push image to registry
22

33
on:
44
push:
5-
branches:
6-
- main
75
schedule:
86
- cron: "0 10 * * 1"
97
workflow_dispatch:
@@ -18,6 +16,7 @@ jobs:
1816
matrix:
1917
php-version:
2018
- 8.2
19+
- 8.4
2120

2221
steps:
2322
- name: Checkout
@@ -49,4 +48,4 @@ jobs:
4948
tags: ${{ steps.meta.outputs.tags }}
5049
labels: ${{ steps.meta.outputs.labels }}
5150
no-cache: true
52-
push: true
51+
push: ${{ github.ref == 'refs/heads/main' }}

β€Ž8.4/Dockerfileβ€Ž

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
FROM serversideup/php:8.4-fpm-nginx-alpine
2+
3+
COPY --chmod=755 common/ /
4+
5+
# PHP limits
6+
ENV PHP_MEMORY_LIMIT=256M
7+
ENV PHP_POST_MAX_SIZE=100M
8+
ENV PHP_UPLOAD_MAX_FILE_SIZE=${PHP_POST_MAX_SIZE}
9+
10+
# OPcache settings
11+
ENV PHP_OPCACHE_ENABLE=1
12+
ENV PHP_OPCACHE_INTERNED_STRINGS_BUFFER=8
13+
ENV PHP_OPCACHE_MEMORY_CONSUMPTION=128
14+
ENV PHP_OPCACHE_REVALIDATE_FREQ=2
15+
16+
# PHP-FPM settings
17+
ENV PHP_FPM_PM_CONTROL=ondemand
18+
ENV PHP_FPM_PM_MAX_CHILDREN=20
19+
ENV PHP_FPM_PM_START_SERVERS=2
20+
ENV PHP_FPM_PM_MIN_SPARE_SERVERS=1
21+
ENV PHP_FPM_PM_MAX_SPARE_SERVERS=3
22+
23+
# Laravel settings
24+
ENV AUTORUN_ENABLED=true
25+
ENV AUTORUN_LARAVEL_MIGRATION=true
26+
ENV AUTORUN_LARAVEL_STORAGE_LINK=true
27+
ENV AUTORUN_LARAVEL_CONFIG_CACHE=true
28+
ENV AUTORUN_LARAVEL_EVENT_CACHE=true
29+
ENV AUTORUN_LARAVEL_ROUTE_CACHE=true
30+
ENV AUTORUN_LARAVEL_VIEW_CACHE=true
31+
ENV AUTORUN_LARAVEL_FILAMENT=true
32+
33+
ENV HEALTHCHECK_PATH=/up
34+
35+
# Composer settings
36+
ENV COMPOSER_NO_INTERACTION=1
37+
ENV COMPOSER_FUND=0
38+
39+
# Switch to root so we can do root things
40+
USER root
41+
42+
# Install additional PHP extensions
43+
RUN set -ex; \
44+
install-php-extensions \
45+
event \
46+
excimer \
47+
exif \
48+
gd \
49+
intl;
50+
51+
# Drop back to our unprivileged user
52+
USER www-data
53+
54+
ARG VERSION
55+
ARG REVISION
56+
57+
RUN echo "$VERSION (${REVISION:0:7})" > ${APP_BASE_DIR}/.version
58+
59+
EXPOSE 8080 8443
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#!/bin/sh
2+
if [ "$SHOW_WELCOME_MESSAGE" = "false" ] || [ "$LOG_OUTPUT_LEVEL" = "off" ] || [ "$DISABLE_DEFAULT_CONFIG" = "true" ]; then
3+
if [ "$LOG_OUTPUT_LEVEL" = "debug" ]; then
4+
echo "πŸ‘‰ $0: Container info was display was skipped."
5+
fi
6+
# Skip the rest of the script
7+
return 0
8+
fi
9+
10+
PHP_OPCACHE_STATUS=$(php -r 'echo ini_get("opcache.enable");')
11+
12+
if [ "$PHP_OPCACHE_STATUS" = "1" ]; then
13+
PHP_OPCACHE_MESSAGE="βœ… Enabled"
14+
else
15+
PHP_OPCACHE_MESSAGE="❌ Disabled"
16+
fi
17+
18+
echo '
19+
-------------------------------------
20+
ℹ️ Container Information
21+
-------------------------------------'
22+
echo "
23+
OS: $(. /etc/os-release; echo "${PRETTY_NAME}")
24+
Docker user: $(whoami)
25+
Docker uid: $(id -u)
26+
Docker gid: $(id -g)
27+
OPcache: $PHP_OPCACHE_MESSAGE
28+
PHP Version: $(php -r 'echo phpversion();')
29+
Image Version: $(cat /etc/serversideup-php-version)
30+
"
31+
32+
if [ "$PHP_OPCACHE_STATUS" = "0" ]; then
33+
echo "πŸ‘‰ [NOTICE]: Improve PHP performance by setting PHP_OPCACHE_ENABLE=1 (recommended for production)."
34+
fi
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/bin/sh
2+
script_name="filament-automations"
3+
4+
if [ "$DISABLE_DEFAULT_CONFIG" = "false" ]; then
5+
# Check to see if an Artisan file exists and assume it means Laravel is configured.
6+
if [ -f "$APP_BASE_DIR/artisan" ]; then
7+
echo "Checking for Filament automations..."
8+
############################################################################
9+
# artisan filament:optimize
10+
############################################################################
11+
if [ "${AUTORUN_LARAVEL_FILAMENT:=true}" = "true" ]; then
12+
echo "πŸš€ Caching filament components and Blade icons.."
13+
php "$APP_BASE_DIR/artisan" filament:optimize
14+
fi
15+
fi
16+
else
17+
if [ "$LOG_OUTPUT_LEVEL" = "debug" ]; then
18+
echo "πŸ‘‰ $script_name: DISABLE_DEFAULT_CONFIG does not equal 'false', so automations will NOT be performed."
19+
fi
20+
fi
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/bin/sh
2+
script_name="laravel-about"
3+
4+
if [ "$DISABLE_DEFAULT_CONFIG" = "false" ]; then
5+
# Check to see if an Artisan file exists and assume it means Laravel is configured.
6+
if [ -f "$APP_BASE_DIR/artisan" ] && [ "${AUTORUN_LARAVEL_ABOUT:=true}" = "true" ]; then
7+
php "$APP_BASE_DIR/artisan" about
8+
fi
9+
else
10+
if [ "$LOG_OUTPUT_LEVEL" = "debug" ]; then
11+
echo "πŸ‘‰ $script_name: DISABLE_DEFAULT_CONFIG does not equal 'false', so automations will NOT be performed."
12+
fi
13+
fi
14+
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
alias artisan="php '$APP_BASE_DIR'/artisan"

0 commit comments

Comments
Β (0)