Last active
March 28, 2023 16:41
-
-
Save icedream/e8c4008e8e5d24a730c3bb20fd58a099 to your computer and use it in GitHub Desktop.
Nextcloud Alpine Docker image with modified imagemagick to work around wrongly rendered single-letter avatars
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# HACK - compile imagemagick package with --without-rsvg flag to work around #34755 | |
FROM nextcloud:26-fpm-alpine AS custom-imagemagick | |
# Build deps | |
RUN apk add --no-cache \ | |
alpine-sdk grep \ | |
chrpath fontconfig-dev freetype-dev ghostscript-dev lcms2-dev libheif-dev \ | |
libjpeg-turbo-dev libpng-dev libjxl-dev librsvg-dev libtool libwebp-dev \ | |
libx11-dev libxext-dev libxml2-dev perl-dev tiff-dev zlib-dev \ | |
ghostscript-fonts graphviz | |
# Make cache dir writable | |
RUN mkdir -p /var/cache/distfiles && \ | |
chmod a+w /var/cache/distfiles | |
# Can't build packages as root | |
RUN adduser -D -k /var/empty -h /var/tmp/apkbuild apkbuild | |
USER apkbuild | |
WORKDIR /var/tmp/apkbuild/imagemagick | |
RUN abuild-keygen -a -n | |
# Download matching APKBUILD of imagemagick for this Alpine version | |
RUN \ | |
set -x && \ | |
. /etc/os-release && \ | |
VERSION=$(printf '%s' "$VERSION_ID" | grep -Po '^\d+\.\d+') && \ | |
wget -OAPKBUILD https://git.alpinelinux.org/aports/plain/community/imagemagick/APKBUILD?id=${VERSION}-stable | |
# They moved the archived versions to another URL... | |
RUN sed -i \ | |
-e 's,--with-rsvg,--without-rsvg,' \ | |
-e 's,https://imagemagick.org/archive/,https://imagemagick.org/archive/releases/,' \ | |
APKBUILD | |
RUN abuild | |
### | |
FROM nextcloud:26-fpm-alpine | |
COPY --from=custom-imagemagick /var/tmp/apkbuild/.abuild/*.pub /etc/apk/keys/ | |
COPY --from=custom-imagemagick /var/tmp/apkbuild/packages/ /root/packages/ | |
RUN set -ex; \ | |
apk add --no-cache /root/packages/apkbuild/*/*.apk; \ | |
rm -r /root/packages |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment