From b2838881eea6be91f23214c5b9109f10a40654c3 Mon Sep 17 00:00:00 2001 From: Dominik Pfaffenbauer Date: Mon, 9 Jan 2023 15:36:23 +0100 Subject: [PATCH] fix issue with heif and add test for it --- .github/files/test_heif.php | 13 ++++++++ .github/workflows/test.yml | 1 + Dockerfile | 61 ++++++++++++++++++------------------- 3 files changed, 44 insertions(+), 31 deletions(-) create mode 100644 .github/files/test_heif.php diff --git a/.github/files/test_heif.php b/.github/files/test_heif.php new file mode 100644 index 0000000..f5abd2b --- /dev/null +++ b/.github/files/test_heif.php @@ -0,0 +1,13 @@ +newImage(1, 1, new \ImagickPixel('red')); + $image->writeImage('avif'.':'.$tmpFile); + unlink($tmpFile); + + return 0; +} catch (\Exception $e) { + return 1; +} \ No newline at end of file diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 5fea521..5df3e16 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -70,6 +70,7 @@ jobs: fi docker run --rm pimcore-image composer create-project pimcore/skeleton:^10.0 pimcore --no-scripts + docker run -v "$(pwd)/.github/files":/var/www/html --rm pimcore-image php test_heif.php - name: Run Trivy vulnerability scanner uses: aquasecurity/trivy-action@master with: diff --git a/Dockerfile b/Dockerfile index 1d79f65..0a62d07 100644 --- a/Dockerfile +++ b/Dockerfile @@ -27,57 +27,54 @@ RUN set -eux; \ docker-php-ext-install pcntl intl mbstring mysqli bcmath bz2 soap xsl pdo pdo_mysql fileinfo exif zip opcache sockets; \ \ git clone https://aomedia.googlesource.com/aom; \ - mkdir aom-build; \ - cmake -S aom/ -B aom-build/; \ - cd aom-build; \ - make --jobs=$(nproc); \ - make install; \ - ldconfig /usr/local/lib; \ - cd ..; \ - rm -Rf aom; \ - rm -Rf aom-build; \ + mkdir aom-build; \ + cmake -S aom/ -B aom-build/; \ + cd aom-build; \ + make --jobs=$(nproc); \ + make install; \ + cd ..; \ + rm -Rf aom; \ + rm -Rf aom-build; \ \ git clone https://github.com/AOMediaCodec/libavif.git; \ - mkdir libavif-build; \ - cmake -S libavif/ -B libavif-build/; \ - cd libavif-build; \ - make --jobs=$(nproc); \ - make install; \ - ldconfig /usr/local/lib; \ - cd ..; \ - rm -Rf libavif; \ - rm -Rf libavif-build; \ + mkdir libavif-build; \ + cmake -S libavif/ -B libavif-build/; \ + cd libavif-build; \ + make --jobs=$(nproc); \ + make V=0; \ + make install; \ + cd ..; \ + rm -Rf libavif; \ + rm -Rf libavif-build; \ \ git clone https://github.com/strukturag/libheif.git; \ - cd libheif; \ - ./autogen.sh; \ - ./configure; \ - make --jobs=$(nproc); \ - make install; \ - ldconfig /usr/local/lib; \ - cd ..; \ - rm -Rf libheif; \ + cd libheif; \ + ./autogen.sh; \ + ./configure; \ + make V=0; \ + make --jobs=$(nproc); \ + make install; \ + cd ..; \ + rm -Rf libheif; \ \ wget https://imagemagick.org/archive/ImageMagick.tar.gz; \ tar -xvf ImageMagick.tar.gz; \ cd ImageMagick-7.*; \ ./configure; \ make --jobs=$(nproc); \ + make V=0; \ make install; \ - ldconfig /usr/local/lib; \ cd ..; \ rm -rf ImageMagick*; \ \ docker-php-ext-configure gd -enable-gd --with-freetype --with-jpeg --with-webp; \ docker-php-ext-install gd; \ - pecl install -f xmlrpc; \ - pecl install imagick; \ - pecl install apcu; \ - pecl install redis; \ + pecl install -f xmlrpc imagick apcu redis; \ docker-php-ext-enable redis imagick apcu; \ docker-php-ext-configure imap --with-kerberos --with-imap-ssl; \ docker-php-ext-install imap; \ docker-php-ext-enable imap; \ + ldconfig /usr/local/lib; \ \ cd /tmp; \ \ @@ -90,6 +87,8 @@ RUN set -eux; \ apt-get clean; \ rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/doc/* ~/.composer || true +RUN ldconfig /usr/local/lib; sync; + RUN echo "upload_max_filesize = 100M" >> /usr/local/etc/php/conf.d/20-pimcore.ini; \ echo "memory_limit = 256M" >> /usr/local/etc/php/conf.d/20-pimcore.ini; \ echo "post_max_size = 100M" >> /usr/local/etc/php/conf.d/20-pimcore.ini