1
0
mirror of https://github.com/imgproxy/imgproxy.git synced 2025-01-23 11:14:48 +02:00
imgproxy/docker/Dockerfile

91 lines
2.7 KiB
Docker
Raw Normal View History

2017-07-01 11:59:10 +06:00
FROM alpine:edge
2018-10-25 22:25:54 +06:00
LABEL maintainer="Sergey Alexandrovich <darthsim@gmail.com>"
2017-07-01 11:59:10 +06:00
ENV GOPATH /go
ENV PATH /usr/local/go/bin:$PATH
2018-11-08 16:34:21 +06:00
# Install dependencies
2017-07-01 11:59:10 +06:00
RUN echo "http://dl-cdn.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories \
2018-10-25 22:25:54 +06:00
&& apk --no-cache upgrade \
2019-09-25 15:47:58 +06:00
&& apk add --no-cache curl git ca-certificates go gcc g++ make musl-dev fftw-dev glib-dev libtool expat-dev \
2019-07-17 14:23:54 +03:00
libjpeg-turbo-dev libpng-dev libwebp-dev giflib-dev librsvg-dev libexif-dev lcms2-dev libimagequant-dev \
2019-09-27 17:49:52 +06:00
libheif-dev tiff-dev
2018-11-08 16:34:21 +06:00
# Build ImageMagick
RUN cd /root \
&& mkdir ImageMagick \
&& curl -Ls https://imagemagick.org/download/ImageMagick.tar.gz | tar -xz -C ImageMagick --strip-components 1 \
&& cd ImageMagick \
&& ./configure \
--enable-silent-rules \
--disable-static \
--disable-openmp \
--disable-deprecated \
--disable-docs \
--with-threads \
--without-magick-plus-plus \
--without-utilities \
--without-perl \
--without-bzlib \
--without-dps \
--without-freetype \
--without-jbig \
--without-jpeg \
--without-lcms \
--without-lzma \
--without-png \
--without-tiff \
--without-wmf \
--without-xml \
--without-webp \
&& make install-strip
# Build libvips
RUN cd /root \
&& export VIPS_VERSION=$(curl -s "https://api.github.com/repos/libvips/libvips/releases/latest" | grep '"tag_name":' | sed -E 's/.*"v([^"]+)".*/\1/') \
&& echo "Vips version: $VIPS_VERSION" \
&& curl -Ls https://github.com/libvips/libvips/releases/download/v$VIPS_VERSION/vips-$VIPS_VERSION.tar.gz | tar -xz \
&& cd vips-$VIPS_VERSION \
&& ./configure \
--without-python \
--without-tiff \
--without-OpenEXR \
--enable-debug=no \
--disable-static \
--enable-silent-rules \
&& make install-strip
2019-09-17 15:10:38 +06:00
ADD . /app
WORKDIR /app
2018-11-08 16:34:21 +06:00
# Build imgproxy
2019-09-17 15:10:38 +06:00
RUN cd /app \
2018-11-08 16:34:21 +06:00
&& CGO_LDFLAGS_ALLOW="-s|-w" go build -v -o /usr/local/bin/imgproxy
# Copy compiled libs here to copy them to the final image
RUN cd /root \
&& mkdir libs \
&& ldd /usr/local/bin/imgproxy | grep /usr/local/lib/ | awk '{print $3}' | xargs -I '{}' cp '{}' libs/
# ==================================================================================================
# Final image
2017-07-01 11:59:10 +06:00
FROM alpine:edge
2018-10-25 22:25:54 +06:00
LABEL maintainer="Sergey Alexandrovich <darthsim@gmail.com>"
2018-10-25 22:25:54 +06:00
RUN echo "http://dl-cdn.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories \
&& apk --no-cache upgrade \
2019-09-25 15:47:58 +06:00
&& apk add --no-cache bash ca-certificates fftw glib libltdl expat libjpeg-turbo libpng \
2019-09-27 17:49:52 +06:00
libwebp giflib librsvg libgsf libexif lcms2 libimagequant libheif tiff\
&& rm -rf /var/cache/apk*
2018-11-08 16:34:21 +06:00
COPY --from=0 /usr/local/bin/imgproxy /usr/local/bin/
COPY --from=0 /root/libs/* /usr/local/lib/
2019-03-21 18:47:17 +06:00
ENV VIPS_WARNING=0
2019-03-21 18:54:04 +06:00
ENV MALLOC_ARENA_MAX=4
2019-03-21 18:47:17 +06:00
2017-07-01 11:59:10 +06:00
CMD ["imgproxy"]
EXPOSE 8080