forked from drnic/heroku-buildpack-imagemagick-webp
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile.22
84 lines (69 loc) · 2.93 KB
/
Dockerfile.22
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
FROM heroku/heroku:22-build
ARG DEBIAN_FRONTEND=noninteractive
# See env vars below to update package versions
# * $LIBIMAGEMAGICK_VERSION
# * $LIBWEBP_VERSION
# * $LIBHIEF_VERSION
# * $LIBDE265_VERSION
ENV PATH="/usr/src/imagemagick/bin:$PATH:\$PATH"
ENV CPPPATH="/usr/src/imagemagick/include:$CPPPATH"
ENV CPATH="/usr/src/imagemagick/include:$CPATH"
ENV LIBRARY_PATH="/usr/src/imagemagick/lib:$LIBRARY_PATH"
ENV LD_LIBRARY_PATH="/usr/src/imagemagick/lib:$LD_LIBRARY_PATH"
RUN apt-get update && apt-get install -y \
libheif-dev libjpeg-dev libpng-dev libtiff-dev libgif-dev libomp-dev libwebp-dev libde265-dev
# https://github.com/strukturag/libde265/releases
ENV LIBDE265_VERSION=1.0.12
RUN curl -L https://github.com/strukturag/libde265/releases/download/v$LIBDE265_VERSION/libde265-$LIBDE265_VERSION.tar.gz | tar zx \
&& cd libde265-$LIBDE265_VERSION \
&& ./autogen.sh \
&& ./configure --prefix=/usr/src/imagemagick \
&& make -j$(nproc) \
&& make install
# https://github.com/strukturag/libheif/releases
ENV LIBHEIF_VERSION=1.16.2
RUN curl -L https://github.com/strukturag/libheif/releases/download/v$LIBHEIF_VERSION/libheif-$LIBHEIF_VERSION.tar.gz | tar zx \
&& cd libheif-$LIBHEIF_VERSION \
&& mkdir build \
&& cd build \
&& cmake --preset=release .. \
&& make -j$(nproc) \
&& make install
# https://github.com/webmproject/libwebp/tags
ENV LIBWEBP_VERSION=1.3.1
RUN cd /opt \
&& curl -L http://storage.googleapis.com/downloads.webmproject.org/releases/webp/libwebp-$LIBWEBP_VERSION.tar.gz | tar zx \
&& cd libwebp-$LIBWEBP_VERSION \
&& ./configure \
&& make -j$(nproc) \
&& make install
# Remove libwebp from heroku image
RUN ldconfig /usr/src/imagemagick/lib/
# https://github.com/ImageMagick/Website/blob/main/ChangeLog.md
ENV IMAGEMAGICK_VERSION=7.1.1-15
RUN cd /usr/src/ \
&& curl -L https://github.com/ImageMagick/ImageMagick/archive/refs/tags/$IMAGEMAGICK_VERSION.tar.gz | tar zx \
&& cd ImageMagick-7* \
&& ./configure --with-heic=yes --with-webp=yes --prefix=/usr/src/imagemagick \
&& make -j$(nproc) \
&& make install
# Additional copy of libwebp that will be included in the .tar.gz for Heroku
RUN curl -L http://storage.googleapis.com/downloads.webmproject.org/releases/webp/libwebp-$LIBWEBP_VERSION.tar.gz | tar zx \
&& cd libwebp-$LIBWEBP_VERSION \
&& ./configure --prefix=/usr/src/imagemagick \
&& make -j$(nproc) \
&& make install
# Additional copy of libheif that will be included in the .tar.gz for Heroku
RUN curl -L https://github.com/strukturag/libheif/releases/download/v$LIBHEIF_VERSION/libheif-$LIBHEIF_VERSION.tar.gz | tar zx \
&& cd libheif-$LIBHEIF_VERSION \
&& mkdir -p build \
&& cd build \
&& cmake -DCMAKE_INSTALL_PREFIX=/usr/src/imagemagick .. \
&& make -j$(nproc) \
&& make install
RUN cd /usr/src/imagemagick \
&& rm -rf build \
&& mkdir build \
&& tar czf \
/usr/src/imagemagick/build/imagemagick-heroku-22.tar.gz bin include lib etc share
CMD ["tail", "-f", "/dev/null"]