From 290dbb93aa362189aab6a3695b2487c347974e0e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20B=C3=BCchner?= Date: Mon, 7 Oct 2024 15:59:16 +0200 Subject: [PATCH] Installed module drupal/media_thumbnails_pdf for PDF preview (Imagemagick and Ghostscript required) --- Dockerfile | 46 ++++++++---- composer.json | 7 +- composer.lock | 204 ++++++++++++++++++++++++++++++++++++++------------ 3 files changed, 192 insertions(+), 65 deletions(-) diff --git a/Dockerfile b/Dockerfile index fa3b0de..79db8ab 100755 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM composer:2 AS COMPOSER_CHAIN +FROM composer:2 AS cchain COPY / /tmp/ddbpro WORKDIR /tmp/ddbpro RUN composer install --no-dev @@ -9,29 +9,31 @@ RUN { \ } >> /tmp/ddbpro/version; \ rm -rf .git/; -FROM node:16-alpine AS NODE_CHAIN -COPY --from=COMPOSER_CHAIN /tmp/ddbpro/ /tmp/ddbpro +FROM node:16-alpine AS nchain +COPY --from=cchain /tmp/ddbpro/ /tmp/ddbpro WORKDIR /tmp/ddbpro RUN yarn && yarn build FROM php:8.3-fpm-alpine -MAINTAINER Michael Büchner +LABEL org.opencontainers.image.authors="m.buechner@dnb.de" # Install packages -RUN apk --no-cache add \ - curl \ - ffmpeg \ - nginx \ - nginx-mod-http-brotli \ - redis \ - supervisor; \ - apk add --no-cache -X http://dl-cdn.alpinelinux.org/alpine/edge/community \ - supercronic; +RUN apk --update --no-cache add -X https://dl-cdn.alpinelinux.org/alpine/edge/community supercronic; \ + apk --update --no-cache add \ + curl \ + ghostscript \ + imagemagick \ + ffmpeg \ + nginx \ + nginx-mod-http-brotli \ + redis \ + supervisor; RUN set -eux; \ \ apk add --no-cache --virtual .build-deps \ coreutils \ + imagemagick-dev \ freetype-dev \ libjpeg-turbo-dev \ libpng-dev \ @@ -60,6 +62,22 @@ RUN set -eux; \ pecl install oauth apcu redis; \ docker-php-ext-enable apcu oauth redis; \ \ + # Source: https://github.com/docker-library/wordpress/blob/3f1a0cab9f2f938bbc57f5f92ec11eeea4511636/latest/php8.3/fpm-alpine/Dockerfile#L47 + # WARNING: imagick is likely not supported on Alpine: https://github.com/Imagick/imagick/issues/328 + # https://pecl.php.net/package/imagick + # https://github.com/Imagick/imagick/commit/5ae2ecf20a1157073bad0170106ad0cf74e01cb6 (causes a lot of build failures, but strangely only intermittent ones 🤔) + # see also https://github.com/Imagick/imagick/pull/641 + # this is "pecl install imagick-3.7.0", but by hand so we can apply a small hack / part of the above commit + curl -fL -o imagick.tgz 'https://pecl.php.net/get/imagick-3.7.0.tgz'; \ + echo '5a364354109029d224bcbb2e82e15b248be9b641227f45e63425c06531792d3e *imagick.tgz' | sha256sum -c -; \ + tar --extract --directory /tmp --file imagick.tgz imagick-3.7.0; \ + grep '^//#endif$' /tmp/imagick-3.7.0/Imagick.stub.php; \ + test "$(grep -c '^//#endif$' /tmp/imagick-3.7.0/Imagick.stub.php)" = '1'; \ + sed -i -e 's!^//#endif$!#endif!' /tmp/imagick-3.7.0/Imagick.stub.php; \ + grep '^//#endif$' /tmp/imagick-3.7.0/Imagick.stub.php && exit 1 || :; \ + docker-php-ext-install /tmp/imagick-3.7.0; \ + rm -rf imagick.tgz /tmp/imagick-3.7.0; \ + \ runDeps="$( \ scanelf --needed --nobanner --format '%n#p' --recursive /usr/local \ | tr ',' '\n' \ @@ -89,7 +107,7 @@ COPY --chown=${RUN_USER}:${RUN_GROUP} config/supervisord/supervisord.conf /etc/s # Add application WORKDIR /var/www/html -COPY --chown=${RUN_USER}:${RUN_GROUP} --from=NODE_CHAIN /tmp/ddbpro/ . +COPY --chown=${RUN_USER}:${RUN_GROUP} --from=nchain /tmp/ddbpro/ . ENV PATH=${PATH}:/var/www/html/vendor/bin RUN \ diff --git a/composer.json b/composer.json index aed3e14..23ec05a 100644 --- a/composer.json +++ b/composer.json @@ -35,10 +35,11 @@ "drupal/field_group": "^3.2", "drupal/field_validation": "^3.0@beta", "drupal/focal_point": "^2.0", - "drupal/gin": "3.x-dev@dev", + "drupal/gin": "^3.0@RC", "drupal/gin_toolbar": "^1.0@beta", "drupal/health_check": "^3.0", "drupal/honeypot": "^2.2", + "drupal/imce": "^3.1", "drupal/jquery_ui_accordion": "^2.0", "drupal/jquery_ui_datepicker": "^2.1", "drupal/jquery_ui_slider": "^2.1", @@ -49,6 +50,7 @@ "drupal/linkit": "^6.0@beta", "drupal/masquerade": "^2.0@beta", "drupal/matomo": "^1.18", + "drupal/media_thumbnails_pdf": "^2.0", "drupal/media_thumbnails_video": "^2.0", "drupal/menu_item_extras": "^3.0", "drupal/metatag": "^2.0", @@ -94,7 +96,8 @@ }, "platform": { "php": "8.3", - "ext-gd": "1" + "ext-gd": "1", + "ext-imagick": "6" } }, "autoload": { diff --git a/composer.lock b/composer.lock index 3887d4a..c3a633b 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "8e20a725f96efae59175a2cfae6ed7a4", + "content-hash": "8b1c4da202a3f1c1894dc84369a8c07d", "packages": [ { "name": "algolia/places", @@ -1932,16 +1932,16 @@ }, { "name": "drupal/core", - "version": "10.3.5", + "version": "10.3.6", "source": { "type": "git", "url": "https://github.com/drupal/core.git", - "reference": "831a269a4d99957638977ec325c3346f896d9f08" + "reference": "168ec99f2012aeb4e93c6c7dd4a90dc919ae96c6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/drupal/core/zipball/831a269a4d99957638977ec325c3346f896d9f08", - "reference": "831a269a4d99957638977ec325c3346f896d9f08", + "url": "https://api.github.com/repos/drupal/core/zipball/168ec99f2012aeb4e93c6c7dd4a90dc919ae96c6", + "reference": "168ec99f2012aeb4e93c6c7dd4a90dc919ae96c6", "shasum": "" }, "require": { @@ -2090,13 +2090,13 @@ ], "description": "Drupal is an open source content management platform powering millions of websites and applications.", "support": { - "source": "https://github.com/drupal/core/tree/10.3.5" + "source": "https://github.com/drupal/core/tree/10.3.6" }, - "time": "2024-09-12T09:45:37+00:00" + "time": "2024-10-03T08:58:13+00:00" }, { "name": "drupal/core-composer-scaffold", - "version": "10.3.5", + "version": "10.3.6", "source": { "type": "git", "url": "https://github.com/drupal/core-composer-scaffold.git", @@ -2140,13 +2140,13 @@ "drupal" ], "support": { - "source": "https://github.com/drupal/core-composer-scaffold/tree/10.3.5" + "source": "https://github.com/drupal/core-composer-scaffold/tree/10.3.6" }, "time": "2024-08-22T14:31:34+00:00" }, { "name": "drupal/core-project-message", - "version": "10.3.5", + "version": "10.3.6", "source": { "type": "git", "url": "https://github.com/drupal/core-project-message.git", @@ -2181,22 +2181,22 @@ "drupal" ], "support": { - "source": "https://github.com/drupal/core-project-message/tree/11.0.3" + "source": "https://github.com/drupal/core-project-message/tree/11.0.5" }, "time": "2023-07-24T07:55:25+00:00" }, { "name": "drupal/core-recommended", - "version": "10.3.5", + "version": "10.3.6", "source": { "type": "git", "url": "https://github.com/drupal/core-recommended.git", - "reference": "055a27d032e1fdcbac90976a14bdd152b368d761" + "reference": "5ddec63138dc10869dea5d1cd4e72c977bb9b538" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/drupal/core-recommended/zipball/055a27d032e1fdcbac90976a14bdd152b368d761", - "reference": "055a27d032e1fdcbac90976a14bdd152b368d761", + "url": "https://api.github.com/repos/drupal/core-recommended/zipball/5ddec63138dc10869dea5d1cd4e72c977bb9b538", + "reference": "5ddec63138dc10869dea5d1cd4e72c977bb9b538", "shasum": "" }, "require": { @@ -2205,7 +2205,7 @@ "doctrine/annotations": "~1.14.3", "doctrine/deprecations": "~1.1.3", "doctrine/lexer": "~2.1.1", - "drupal/core": "10.3.5", + "drupal/core": "10.3.6", "egulias/email-validator": "~4.0.2", "guzzlehttp/guzzle": "~7.8.1", "guzzlehttp/promises": "~2.0.2", @@ -2266,9 +2266,9 @@ ], "description": "Core and its dependencies with known-compatible minor versions. Require this project INSTEAD OF drupal/core.", "support": { - "source": "https://github.com/drupal/core-recommended/tree/10.3.5" + "source": "https://github.com/drupal/core-recommended/tree/10.3.6" }, - "time": "2024-09-12T09:45:37+00:00" + "time": "2024-10-03T08:58:13+00:00" }, { "name": "drupal/crop", @@ -2951,11 +2951,17 @@ }, { "name": "drupal/gin", - "version": "dev-3.x", + "version": "3.0.0-rc13", "source": { "type": "git", "url": "https://git.drupalcode.org/project/gin.git", - "reference": "7996c618fe500c8a0d3f0384fab35b3fafa18104" + "reference": "8.x-3.0-rc13" + }, + "dist": { + "type": "zip", + "url": "https://ftp.drupal.org/files/projects/gin-8.x-3.0-rc13.zip", + "reference": "8.x-3.0-rc13", + "shasum": "7b8e9d7ae6fe6de7de0bba930200fe80b437eefe" }, "require": { "drupal/core": "^9 || ^10 || ^11", @@ -2963,15 +2969,12 @@ }, "type": "drupal-theme", "extra": { - "branch-alias": { - "dev-3.x": "3.x-dev" - }, "drupal": { - "version": "8.x-3.0-rc13+34-dev", - "datestamp": "1727440172", + "version": "8.x-3.0-rc13", + "datestamp": "1720416342", "security-coverage": { "status": "not-covered", - "message": "Dev releases are not covered by Drupal security advisories." + "message": "RC releases are not covered by Drupal security advisories." } } }, @@ -3190,6 +3193,56 @@ "issues": "https://www.drupal.org/project/issues/honeypot" } }, + { + "name": "drupal/imce", + "version": "3.1.1", + "source": { + "type": "git", + "url": "https://git.drupalcode.org/project/imce.git", + "reference": "3.1.1" + }, + "dist": { + "type": "zip", + "url": "https://ftp.drupal.org/files/projects/imce-3.1.1.zip", + "reference": "3.1.1", + "shasum": "4c982c08dcf1c6e53dfb58a6cb7859b0f6df83b6" + }, + "require": { + "drupal/core": "^9.3 || ^10 || ^11" + }, + "type": "drupal-module", + "extra": { + "drupal": { + "version": "3.1.1", + "datestamp": "1722725345", + "security-coverage": { + "status": "covered", + "message": "Covered by Drupal's security advisory policy" + } + } + }, + "notification-url": "https://packages.drupal.org/8/downloads", + "license": [ + "GPL-2.0-or-later" + ], + "authors": [ + { + "name": "See contributors", + "homepage": "https://www.drupal.org/node/2841111/committers", + "role": "Developer" + }, + { + "name": "ufku", + "homepage": "https://www.drupal.org/user/9910" + } + ], + "description": "Provides a file manager supporting personal folders.", + "homepage": "https://drupal.org/project/imce", + "support": { + "source": "https://git.drupalcode.org/project/imce", + "issues": "https://www.drupal.org/project/issues/imce" + } + }, { "name": "drupal/jquery_ui", "version": "1.7.0", @@ -3939,6 +3992,58 @@ "issues": "https://www.drupal.org/project/issues/media_thumbnails" } }, + { + "name": "drupal/media_thumbnails_pdf", + "version": "2.0.1", + "source": { + "type": "git", + "url": "https://git.drupalcode.org/project/media_thumbnails_pdf.git", + "reference": "2.0.1" + }, + "dist": { + "type": "zip", + "url": "https://ftp.drupal.org/files/projects/media_thumbnails_pdf-2.0.1.zip", + "reference": "2.0.1", + "shasum": "e5543fd50f049f638b4b4673f2304fbfd5ac5992" + }, + "require": { + "drupal/core": "^9.3 || ^10 || ^11", + "drupal/media_thumbnails": "^1.0 || ^2.0", + "ext-imagick": "*" + }, + "type": "drupal-module", + "extra": { + "drupal": { + "version": "2.0.1", + "datestamp": "1727954226", + "security-coverage": { + "status": "covered", + "message": "Covered by Drupal's security advisory policy" + } + } + }, + "notification-url": "https://packages.drupal.org/8/downloads", + "license": [ + "GPL-2.0-or-later" + ], + "authors": [ + { + "name": "Boris Böhne (drubb)", + "homepage": "https://www.drupal.org/u/drubb", + "role": "Maintainer" + }, + { + "name": "renrhaf", + "homepage": "https://www.drupal.org/user/2478454" + } + ], + "description": "Generate custom thumbnails for pdf media entities.", + "homepage": "https://drupal.org/project/media_thumbnails_pdf", + "support": { + "source": "https://cgit.drupalcode.org/media_thumbnails_pdf", + "issues": "https://drupal.org/project/issues/media_thumbnails_pdf" + } + }, { "name": "drupal/media_thumbnails_video", "version": "2.0.0", @@ -6352,16 +6457,16 @@ }, { "name": "illuminate/collections", - "version": "v11.25.0", + "version": "v11.26.0", "source": { "type": "git", "url": "https://github.com/illuminate/collections.git", - "reference": "465044f988f9a07c901388beeb15201d711387aa" + "reference": "4d333ea19a27230b424b9af56f34cd658b5bbce2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/illuminate/collections/zipball/465044f988f9a07c901388beeb15201d711387aa", - "reference": "465044f988f9a07c901388beeb15201d711387aa", + "url": "https://api.github.com/repos/illuminate/collections/zipball/4d333ea19a27230b424b9af56f34cd658b5bbce2", + "reference": "4d333ea19a27230b424b9af56f34cd658b5bbce2", "shasum": "" }, "require": { @@ -6403,11 +6508,11 @@ "issues": "https://github.com/laravel/framework/issues", "source": "https://github.com/laravel/framework" }, - "time": "2024-09-25T15:08:32+00:00" + "time": "2024-09-27T14:54:48+00:00" }, { "name": "illuminate/conditionable", - "version": "v11.25.0", + "version": "v11.26.0", "source": { "type": "git", "url": "https://github.com/illuminate/conditionable.git", @@ -6453,7 +6558,7 @@ }, { "name": "illuminate/contracts", - "version": "v11.25.0", + "version": "v11.26.0", "source": { "type": "git", "url": "https://github.com/illuminate/contracts.git", @@ -6501,7 +6606,7 @@ }, { "name": "illuminate/macroable", - "version": "v11.25.0", + "version": "v11.26.0", "source": { "type": "git", "url": "https://github.com/illuminate/macroable.git", @@ -7278,7 +7383,7 @@ }, { "name": "phootwork/collection", - "version": "v3.2.2", + "version": "v3.2.3", "source": { "type": "git", "url": "https://github.com/phootwork/collection.git", @@ -7327,22 +7432,22 @@ ], "support": { "issues": "https://github.com/phootwork/phootwork/issues", - "source": "https://github.com/phootwork/collection/tree/v3.2.2" + "source": "https://github.com/phootwork/collection/tree/v3.2.3" }, "time": "2022-08-27T12:51:24+00:00" }, { "name": "phootwork/lang", - "version": "v3.2.2", + "version": "v3.2.3", "source": { "type": "git", "url": "https://github.com/phootwork/lang.git", - "reference": "baaf154ae7d521ebeee5e89105f5b12b0f234597" + "reference": "52ec8cce740ce1c424eef02f43b43d5ddfec7b5e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phootwork/lang/zipball/baaf154ae7d521ebeee5e89105f5b12b0f234597", - "reference": "baaf154ae7d521ebeee5e89105f5b12b0f234597", + "url": "https://api.github.com/repos/phootwork/lang/zipball/52ec8cce740ce1c424eef02f43b43d5ddfec7b5e", + "reference": "52ec8cce740ce1c424eef02f43b43d5ddfec7b5e", "shasum": "" }, "require": { @@ -7376,9 +7481,9 @@ ], "support": { "issues": "https://github.com/phootwork/phootwork/issues", - "source": "https://github.com/phootwork/lang/tree/v3.2.2" + "source": "https://github.com/phootwork/lang/tree/v3.2.3" }, - "time": "2023-05-26T05:37:59+00:00" + "time": "2024-10-03T13:43:19+00:00" }, { "name": "php-ffmpeg/php-ffmpeg", @@ -7679,16 +7784,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.12.5", + "version": "1.12.6", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "7e6c6cb7cecb0a6254009a1a8a7d54ec99812b17" + "reference": "dc4d2f145a88ea7141ae698effd64d9df46527ae" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/7e6c6cb7cecb0a6254009a1a8a7d54ec99812b17", - "reference": "7e6c6cb7cecb0a6254009a1a8a7d54ec99812b17", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/dc4d2f145a88ea7141ae698effd64d9df46527ae", + "reference": "dc4d2f145a88ea7141ae698effd64d9df46527ae", "shasum": "" }, "require": { @@ -7733,7 +7838,7 @@ "type": "github" } ], - "time": "2024-09-26T12:45:22+00:00" + "time": "2024-10-06T15:03:59+00:00" }, { "name": "phpstan/phpstan-deprecation-rules", @@ -11838,7 +11943,7 @@ "minimum-stability": "alpha", "stability-flags": { "drupal/field_validation": 10, - "drupal/gin": 20, + "drupal/gin": 5, "drupal/gin_toolbar": 10, "drupal/linkchecker": 15, "drupal/linkit": 10, @@ -11857,7 +11962,8 @@ "platform-dev": [], "platform-overrides": { "php": "8.3", - "ext-gd": "1" + "ext-gd": "1", + "ext-imagick": "6" }, "plugin-api-version": "2.3.0" }