2018-04-13 19:02:28 +00:00
|
|
|
# Copyright 2018 The Perkeep Authors.
|
|
|
|
# Licensed under the Apache License, Version 2.0
|
|
|
|
FROM alpine:3.7 as builder
|
|
|
|
MAINTAINER Perkeep Contributors <perkeep@googlegroups.com>
|
2018-04-23 04:01:09 +00:00
|
|
|
RUN apk add --no-cache \
|
|
|
|
git alpine-sdk automake autoconf libtool \
|
|
|
|
libjpeg-turbo-dev bash
|
2018-04-20 20:55:34 +00:00
|
|
|
|
2018-04-13 19:02:28 +00:00
|
|
|
# Fetch and build heiftojpeg.
|
|
|
|
WORKDIR /tmp
|
2018-04-23 04:01:09 +00:00
|
|
|
RUN git clone https://github.com/strukturag/libde265.git
|
|
|
|
WORKDIR libde265
|
2018-04-20 20:55:34 +00:00
|
|
|
|
2018-04-23 04:01:09 +00:00
|
|
|
RUN ./autogen.sh
|
|
|
|
RUN ./configure
|
|
|
|
RUN make install
|
2018-04-13 19:02:28 +00:00
|
|
|
|
2018-04-23 04:01:09 +00:00
|
|
|
ENV IM_VERSION 859511c029bb8e9ea02037f5672e0fd741abf414
|
2018-04-13 19:02:28 +00:00
|
|
|
|
|
|
|
WORKDIR ..
|
2018-04-23 04:01:09 +00:00
|
|
|
RUN git clone https://github.com/ImageMagick/ImageMagick.git
|
|
|
|
WORKDIR ImageMagick
|
|
|
|
|
|
|
|
RUN git reset --hard $IM_VERSION
|
|
|
|
|
|
|
|
RUN ./configure --with-heic=yes --with-jpeg=true --enable-zero-configuration
|
|
|
|
RUN make
|
|
|
|
RUN make install
|
2018-04-13 19:02:28 +00:00
|
|
|
|
|
|
|
FROM alpine:3.7
|
|
|
|
|
2018-04-23 04:01:09 +00:00
|
|
|
COPY --from=builder /usr/local/lib/libMagickCore-7.Q16HDRI.so.5 /usr/local/lib/libMagickCore-7.Q16HDRI.so.5
|
|
|
|
COPY --from=builder /usr/local/lib/libMagickWand-7.Q16HDRI.so.5 /usr/local/lib/libMagickWand-7.Q16HDRI.so.5
|
2018-04-13 19:02:28 +00:00
|
|
|
COPY --from=builder /usr/lib/libstdc++.so.6 /usr/lib/libstdc++.so.6
|
|
|
|
COPY --from=builder /usr/lib/libgcc_s.so.1 /usr/lib/libgcc_s.so.1
|
|
|
|
COPY --from=builder /lib/ld-musl-x86_64.so.1 /lib/ld-musl-x86_64.so.1
|
|
|
|
COPY --from=builder /usr/lib/libjpeg.so.8 /usr/lib/libjpeg.so.8
|
2018-04-23 04:01:09 +00:00
|
|
|
COPY --from=builder /usr/local/lib/libde265.so.0 /usr/local/lib/libde265.so.0
|
|
|
|
COPY --from=builder /usr/lib/libgomp.so.1 /usr/lib/libgomp.so.1
|
|
|
|
COPY --from=builder /usr/local/etc/ImageMagick-7/magic.xml /usr/local/etc/ImageMagick-7/magic.xml
|
2018-04-13 19:02:28 +00:00
|
|
|
|
2018-04-20 21:06:15 +00:00
|
|
|
# Put this at the bottom to take advantage of Docker layer caching. Most of the stuff up there will never change.
|
2018-04-23 04:01:09 +00:00
|
|
|
COPY --from=builder /usr/local/bin/convert /usr/local/bin/convert
|
|
|
|
COPY --from=builder /usr/local/bin/magick /usr/local/bin/magick
|
|
|
|
|
|
|
|
# Commented out to save space, but useful for debugging:
|
|
|
|
# RUN apk add --no-cache bash
|
|
|
|
|
|
|
|
# Test with, e.g.:
|
|
|
|
# docker run -v $HOME/img/:/img -ti gcr.io/perkeep-containers/thumbnail:latest /usr/local/bin/convert /img/rotate.heif -auto-orient /img/rotate.jpg
|
2018-04-20 21:06:15 +00:00
|
|
|
|
2018-04-23 04:01:09 +00:00
|
|
|
CMD ["/usr/local/bin/convert"]
|