Merge pull request #676 from benbrummer/debian

arm64 image with chromium
This commit is contained in:
David Bomba
2024-12-24 18:28:05 +11:00
committed by GitHub
2 changed files with 15 additions and 46 deletions

55
debian/Dockerfile vendored
View File

@@ -1,75 +1,46 @@
FROM php:8.3-fpm AS base FROM php:8.3-fpm AS base
ARG php_require="bcmath gd pdo_mysql zip" ARG php_require="bcmath gd pdo_mysql zip"
ARG php_suggest="exif imagick intl pcntl soap" ARG php_suggest="exif imagick intl pcntl soap saxon-12.5.0"
ARG php_suggest_debian="saxon-12.5.0"
ARG php_extra="opcache" ARG php_extra="opcache"
# Install system dependencies # Install system dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \ RUN apt-get update && apt-get install -y --no-install-recommends \
default-mysql-client \ mariadb-client \
gpg \ gpg \
gosu \
supervisor \ supervisor \
# Unicode support for PDF # Unicode support for PDF
fonts-noto-cjk-extra \ fonts-noto-cjk-extra \
fonts-wqy-microhei \ fonts-wqy-microhei \
fonts-wqy-zenhei \ fonts-wqy-zenhei \
xfonts-wqy \ xfonts-wqy \
# Install google-chrome-stable(amd64)/chromium(arm64)
&& if [ "$(dpkg --print-architecture)" = "amd64" ]; then \ && if [ "$(dpkg --print-architecture)" = "amd64" ]; then \
mkdir -p /etc/apt/keyrings \ mkdir -p /etc/apt/keyrings \
&& curl -fsSL https://dl.google.com/linux/linux_signing_key.pub | \ && curl -fsSL https://dl.google.com/linux/linux_signing_key.pub | \
gpg --dearmor -o /etc/apt/keyrings/google.gpg \ 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 \ && 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 update \
&& apt-get install -y --no-install-recommends google-chrome-stable \ && 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; \
elif [ "$(dpkg --print-architecture)" = "arm64" ]; then \ elif [ "$(dpkg --print-architecture)" = "arm64" ]; then \
apt-get install -y --no-install-recommends \ apt-get install -y --no-install-recommends \
# Packages for chrome chromium; \
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; \
fi \ 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 purge -y gpg \
&& apt-get autoremove -y \ && apt-get autoremove -y \
&& apt-get clean \ && apt-get clean \
&& rm -rf /var/lib/apt/lists/* && rm -rf /var/lib/apt/lists/*
# Install Required PHP extensions. # Install PHP extensions
RUN if [ "$(dpkg --print-architecture)" = "amd64" ]; then \ RUN ( curl -sSLf https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions -o - || echo 'return 1' ) | sh -s \
( 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 \
${php_require} \ ${php_require} \
${php_suggest} \ ${php_suggest} \
${php_extra} \ ${php_extra} \
@composer; \ @composer
fi
# Configure PHP # Configure PHP
RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini" RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini"
@@ -112,7 +83,5 @@ COPY --chmod=0755 scripts/init.sh /usr/local/bin/init.sh
HEALTHCHECK --interval=30s --timeout=5s --start-period=30s --retries=3 \ HEALTHCHECK --interval=30s --timeout=5s --start-period=30s --retries=3 \
CMD php -v || exit 1 CMD php -v || exit 1
EXPOSE 9000
ENTRYPOINT ["/usr/local/bin/init.sh"] ENTRYPOINT ["/usr/local/bin/init.sh"]
CMD ["supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"] CMD ["supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"]

View File

@@ -56,9 +56,9 @@ if [ "$*" = 'supervisord -c /etc/supervisor/conf.d/supervisord.conf' ]; then
# Clear and cache config in production # Clear and cache config in production
if [ "$APP_ENV" = "production" ]; then if [ "$APP_ENV" = "production" ]; then
gosu www-data php artisan optimize runuser -u www-data -- php artisan optimize
gosu www-data php artisan package:discover runuser -u www-data -- php artisan package:discover
gosu www-data php artisan migrate --force runuser -u www-data -- php artisan migrate --force
# If first IN run, it needs to be initialized # If first IN run, it needs to be initialized
echo "Checking initialization status..." echo "Checking initialization status..."