From ebc6c3642a9319f0059be5ef0b0e1487935de788 Mon Sep 17 00:00:00 2001 From: Benjamin Brummer Date: Thu, 8 May 2025 06:43:03 +0000 Subject: [PATCH 1/4] remove cache volume and healthcheck configuration --- debian/docker-compose.yml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/debian/docker-compose.yml b/debian/docker-compose.yml index 73160b9..eefcd47 100644 --- a/debian/docker-compose.yml +++ b/debian/docker-compose.yml @@ -9,7 +9,6 @@ x-logging: &default-logging x-app-volumes: &volumes volumes: - ./.env:/app/.env - - app_cache:/var/www/html/bootstrap/cache - app_storage:/app/storage - caddy_data:/data @@ -31,9 +30,6 @@ services: environment: LARAVEL_ROLE: app <<: *volumes - # HEALTHCHECK from frankenphp image - healthcheck: - start_period: 180s depends_on: mysql: condition: service_healthy @@ -143,7 +139,6 @@ services: # logging: *default-logging volumes: - app_cache: app_storage: caddy_data: mysql_data: From 0c607953ec390f74d085df511354d1c20b905356 Mon Sep 17 00:00:00 2001 From: Benjamin Brummer Date: Thu, 8 May 2025 06:43:23 +0000 Subject: [PATCH 2/4] HEALTHCHECK for laravel --- debian/Dockerfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/debian/Dockerfile b/debian/Dockerfile index cb563a6..ed9ea9d 100644 --- a/debian/Dockerfile +++ b/debian/Dockerfile @@ -85,6 +85,8 @@ COPY --chmod=0755 scripts/init.sh /usr/local/bin/init.sh USER ${user} +HEALTHCHECK --start-period=10s CMD curl -f http://localhost/health + ENTRYPOINT ["/usr/local/bin/init.sh"] CMD ["frankenphp", "php-cli", "artisan", "octane:frankenphp"] From 5d29d3a0526d1a635dfb128955dc80c64618d685 Mon Sep 17 00:00:00 2001 From: Benjamin Brummer Date: Thu, 8 May 2025 06:43:50 +0000 Subject: [PATCH 3/4] align init.sh with invoiceninja-debian --- debian/scripts/init.sh | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/debian/scripts/init.sh b/debian/scripts/init.sh index 5732f1b..914e8ee 100755 --- a/debian/scripts/init.sh +++ b/debian/scripts/init.sh @@ -3,6 +3,12 @@ # Fallback to app role=${LARAVEL_ROLE:-app} +# Set PDF generation browser path based on architecture +export SNAPPDF_CHROMIUM_PATH=/usr/bin/google-chrome-stable +if [ "$(dpkg --print-architecture)" = "arm64" ]; then + export SNAPPDF_CHROMIUM_PATH=/usr/bin/chromium +fi + # Check for default CMD, flag(s) or empty CMD if [ "$*" = 'frankenphp php-cli artisan octane:frankenphp' ] || [ "${1#-}" != "$1" ] || [ "$#" -eq "0" ]; then @@ -38,6 +44,12 @@ if [ "$*" = 'frankenphp php-cli artisan octane:frankenphp' ] || [ "${1#-}" != "$ if [ "${role}" = "app" ]; then cmd="frankenphp php-cli artisan octane:frankenphp" + # Check for required folders and create if needed, relevant for bind mounts + # It is not possible to chown, as we are not executing this script as root + [ -d /var/www/html/storage/framework/sessions ] || mkdir -p /var/www/html/storage/framework/sessions + [ -d /var/www/html/storage/framework/views ] || mkdir -p /var/www/html/storage/framework/views + [ -d /var/www/html/storage/framework/cache ] || mkdir -p /var/www/html/storage/framework/cache + if [ "$APP_ENV" = "production" ]; then frankenphp php-cli artisan optimize fi @@ -48,7 +60,7 @@ if [ "$*" = 'frankenphp php-cli artisan octane:frankenphp' ] || [ "${1#-}" != "$ frankenphp php-cli artisan migrate --force # If first IN run, it needs to be initialized - if [ "$(php -d opcache.preload='' artisan tinker --execute='echo Schema::hasTable("accounts") && !App\Models\Account::all()->first();')" = "1" ]; then + if [ "$(frankenphp php-cli artisan tinker --execute='echo Schema::hasTable("accounts") && !App\Models\Account::all()->first();')" = "1" ]; then echo "Running initialization..." frankenphp php-cli artisan db:seed --force @@ -82,11 +94,4 @@ if [ "$*" = 'frankenphp php-cli artisan octane:frankenphp' ] || [ "${1#-}" != "$ fi fi -# Set PDF generation browser path based on architecture -if [ "$(dpkg --print-architecture)" = "amd64" ]; then - export SNAPPDF_CHROMIUM_PATH=/usr/bin/google-chrome-stable -elif [ "$(dpkg --print-architecture)" = "arm64" ]; then - export SNAPPDF_CHROMIUM_PATH=/usr/bin/chromium -fi - exec "$@" From f96d4d4aa00c68fdef0d2ddb1b823f0513d0f918 Mon Sep 17 00:00:00 2001 From: Benjamin Brummer Date: Thu, 8 May 2025 06:58:11 +0000 Subject: [PATCH 4/4] image versions as ARGs --- debian/Dockerfile | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/debian/Dockerfile b/debian/Dockerfile index ed9ea9d..fde50f2 100644 --- a/debian/Dockerfile +++ b/debian/Dockerfile @@ -1,4 +1,8 @@ -FROM dunglas/frankenphp:1-php8.3-bookworm AS prepare-app +ARG PHP_VERSION=8.3 +ARG FRANKENPHP_VERSION=1 +ARG DEBIAN_VERSION=bookworm + +FROM dunglas/frankenphp:${FRANKENPHP_VERSION}-php${PHP_VERSION}-${DEBIAN_VERSION} AS prepare-app RUN curl -sL "https://github.com/invoiceninja/invoiceninja/releases/latest/download/invoiceninja.tar.gz" | \ tar -xz \ @@ -11,7 +15,7 @@ RUN curl -sL "https://github.com/invoiceninja/invoiceninja/releases/latest/downl # ================== # InvoiceNinja image # ================== -FROM dunglas/frankenphp:1-php8.3-bookworm +FROM dunglas/frankenphp:${FRANKENPHP_VERSION}-php${PHP_VERSION}-${DEBIAN_VERSION} ARG user=ninja