From 677cc44a1599f4c099f5edd1b5b81246dc09ffa9 Mon Sep 17 00:00:00 2001 From: Benjamin Brummer Date: Sat, 21 Dec 2024 20:31:42 +0100 Subject: [PATCH 1/6] remove gosu --- debian/Dockerfile | 1 - debian/scripts/init.sh | 6 +++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/debian/Dockerfile b/debian/Dockerfile index c55687b..1e1d565 100644 --- a/debian/Dockerfile +++ b/debian/Dockerfile @@ -9,7 +9,6 @@ ARG php_extra="opcache" RUN apt-get update && apt-get install -y --no-install-recommends \ default-mysql-client \ gpg \ - gosu \ supervisor \ # Unicode support for PDF fonts-noto-cjk-extra \ diff --git a/debian/scripts/init.sh b/debian/scripts/init.sh index 25b0727..8acc15d 100755 --- a/debian/scripts/init.sh +++ b/debian/scripts/init.sh @@ -56,9 +56,9 @@ if [ "$*" = 'supervisord -c /etc/supervisor/conf.d/supervisord.conf' ]; then # Clear and cache config in production if [ "$APP_ENV" = "production" ]; then - gosu www-data php artisan optimize - gosu www-data php artisan package:discover - gosu www-data php artisan migrate --force + runuser -u www-data -- php artisan optimize + runuser -u www-data -- php artisan package:discover + runuser -u www-data -- php artisan migrate --force # If first IN run, it needs to be initialized echo "Checking initialization status..." From c0afd971e14300ffa6fd1cdfedeccd806e930b26 Mon Sep 17 00:00:00 2001 From: Benjamin Brummer Date: Sat, 21 Dec 2024 20:32:22 +0100 Subject: [PATCH 2/6] mariadb is the default on debian --- debian/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/Dockerfile b/debian/Dockerfile index 1e1d565..141131f 100644 --- a/debian/Dockerfile +++ b/debian/Dockerfile @@ -7,7 +7,7 @@ ARG php_extra="opcache" # Install system dependencies RUN apt-get update && apt-get install -y --no-install-recommends \ - default-mysql-client \ + mariadb-client \ gpg \ supervisor \ # Unicode support for PDF From dc3b87140f85ee604118af7c68d0a128a30c8141 Mon Sep 17 00:00:00 2001 From: Benjamin Brummer Date: Sat, 21 Dec 2024 20:36:20 +0100 Subject: [PATCH 3/6] Install chromium for arm64 --- debian/Dockerfile | 32 +++++++------------------------- 1 file changed, 7 insertions(+), 25 deletions(-) diff --git a/debian/Dockerfile b/debian/Dockerfile index 141131f..b7b7557 100644 --- a/debian/Dockerfile +++ b/debian/Dockerfile @@ -15,40 +15,22 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ fonts-wqy-microhei \ fonts-wqy-zenhei \ xfonts-wqy \ + # Install google-chrome-stable(amd64)/chromium(arm64) && if [ "$(dpkg --print-architecture)" = "amd64" ]; then \ mkdir -p /etc/apt/keyrings \ && curl -fsSL https://dl.google.com/linux/linux_signing_key.pub | \ gpg --dearmor -o /etc/apt/keyrings/google.gpg \ && echo "deb [arch=amd64 signed-by=/etc/apt/keyrings/google.gpg] https://dl.google.com/linux/chrome/deb/ stable main" > /etc/apt/sources.list.d/google-chrome.list \ && apt-get update \ - && apt-get install -y --no-install-recommends google-chrome-stable \ - && mkdir -p /var/www/.config/google-chrome \ - && chown -R www-data:www-data /var/www/.config/google-chrome; \ + && apt-get install -y --no-install-recommends google-chrome-stable; \ elif [ "$(dpkg --print-architecture)" = "arm64" ]; then \ apt-get install -y --no-install-recommends \ - # Packages for chrome - fonts-liberation \ - libasound2 \ - libatk-bridge2.0-0 \ - libatk1.0-0 \ - libatspi2.0-0 \ - libcups2 \ - libdbus-1-3 \ - libdrm2 \ - libgbm1 \ - libgtk-3-0 \ - libnspr4 \ - libnss3 \ - libwayland-client0 \ - libxcomposite1 \ - libxdamage1 \ - libxfixes3 \ - libxkbcommon0 \ - libxrandr2 \ - xdg-utils \ - && mkdir -p /var/www/.chrome/chrome-profile \ - && chown -R www-data:www-data /var/www/.chrome/chrome-profile; \ + chromium; \ fi \ + # Create config directory for chromium/google-chrome-stable + && mkdir /var/www/.config \ + && chown www-data:www-data /var/www/.config \ + # Cleanup && apt-get purge -y gpg \ && apt-get autoremove -y \ && apt-get clean \ From 514ebb74c6fc2a23ed0a3fb98b50ef7f782d460d Mon Sep 17 00:00:00 2001 From: Benjamin Brummer Date: Sat, 21 Dec 2024 20:37:16 +0100 Subject: [PATCH 4/6] No need to have arm64 and amd64 for php extensions --- debian/Dockerfile | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/debian/Dockerfile b/debian/Dockerfile index b7b7557..0d5fb67 100644 --- a/debian/Dockerfile +++ b/debian/Dockerfile @@ -36,21 +36,12 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* -# Install Required PHP extensions. -RUN if [ "$(dpkg --print-architecture)" = "amd64" ]; then \ - ( curl -sSLf https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions -o - || echo 'return 1' ) | sh -s \ - ${php_require} \ - ${php_suggest} \ - ${php_suggest_debian} \ - ${php_extra} \ - @composer; \ - elif [ "$(dpkg --print-architecture)" = "arm64" ]; then \ - ( curl -sSLf https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions -o - || echo 'return 1' ) | sh -s \ +# Install PHP extensions +RUN ( curl -sSLf https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions -o - || echo 'return 1' ) | sh -s \ ${php_require} \ ${php_suggest} \ ${php_extra} \ - @composer; \ - fi + @composer # Configure PHP RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini" From 470a3d036d9b86eec22cbb1dc47230480e07e5cd Mon Sep 17 00:00:00 2001 From: Benjamin Brummer Date: Sat, 21 Dec 2024 20:37:47 +0100 Subject: [PATCH 5/6] EXPOSE is already inherited from base image --- debian/Dockerfile | 2 -- 1 file changed, 2 deletions(-) diff --git a/debian/Dockerfile b/debian/Dockerfile index 0d5fb67..2ac7a0f 100644 --- a/debian/Dockerfile +++ b/debian/Dockerfile @@ -84,7 +84,5 @@ COPY --chmod=0755 scripts/init.sh /usr/local/bin/init.sh HEALTHCHECK --interval=30s --timeout=5s --start-period=30s --retries=3 \ CMD php -v || exit 1 -EXPOSE 9000 - ENTRYPOINT ["/usr/local/bin/init.sh"] CMD ["supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"] From 99f280319c955e13ef2fcc1511abe70336f9e516 Mon Sep 17 00:00:00 2001 From: Benjamin Brummer Date: Sat, 21 Dec 2024 20:38:44 +0100 Subject: [PATCH 6/6] saxon is available for arm64 and amd64 --- debian/Dockerfile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/debian/Dockerfile b/debian/Dockerfile index 2ac7a0f..2be80b5 100644 --- a/debian/Dockerfile +++ b/debian/Dockerfile @@ -1,8 +1,7 @@ FROM php:8.3-fpm AS base ARG php_require="bcmath gd pdo_mysql zip" -ARG php_suggest="exif imagick intl pcntl soap" -ARG php_suggest_debian="saxon-12.5.0" +ARG php_suggest="exif imagick intl pcntl soap saxon-12.5.0" ARG php_extra="opcache" # Install system dependencies