Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Libvips build with mozjpeg
FROM node:12.8-buster
ENV NODE_ENV=production
RUN apt-get -y update && \
apt-get -y install build-essential libtiff5-dev libpng-dev \
libfftw3-dev librsvg2-dev libgif-dev libexif-dev \
libexpat1-dev pkg-config glib2.0-dev libimagequant-dev libgsf-1-dev \
liborc-0.4-dev liblcms2-dev autoconf nasm libtool automake \
ffmpeg
ENV VIPS_VERSION=8.8.1
ENV MOZJPEG_VERSION=3.2
ENV LIBWEBP_VERSION=1.0.3
WORKDIR /tmp
ENV LD_LIBRARY_PATH /lib:/usr/lib:/usr/local/lib
# get vips and mozjpeg
ADD https://github.com/mozilla/mozjpeg/releases/download/v${MOZJPEG_VERSION}/mozjpeg-${MOZJPEG_VERSION}-release-source.tar.gz \
https://github.com/libvips/libvips/releases/download/v${VIPS_VERSION}/vips-${VIPS_VERSION}.tar.gz \
https://storage.googleapis.com/downloads.webmproject.org/releases/webp/libwebp-${LIBWEBP_VERSION}.tar.gz \
/tmp/
# compile mozjpeg
RUN tar -xf mozjpeg-${MOZJPEG_VERSION}-release-source.tar.gz && \
cd mozjpeg && ./configure && \
make -j4 V=0 && make install libdir=/usr/lib/x86_64-linux-gnu prefix=/usr && \
cp jpegint.h /usr/include/jpegint.h && \
cd .. && rm -rf mozjpeg
# compile libwebp
RUN tar -xf libwebp-${LIBWEBP_VERSION}.tar.gz && \
cd libwebp-${LIBWEBP_VERSION} && \
./configure --prefix=/usr \
--enable-libwebpmux \
--enable-libwebpdemux \
--enable-libwebpdecoder \
--enable-libwebpextras \
--enable-swap-16bit-csp \
--disable-static && \
make -j4 && make install && \
cd .. && rm -rf libwebp-${LIBWEBP_VERSION}
# compile libvips
RUN tar -xf vips-${VIPS_VERSION}.tar.gz && \
cd vips-${VIPS_VERSION} && \
./configure --without-magick --without-pangoft2 --without-ppm --without-analyze \
--without-radiance --without-OpenEXR --disable-debug \
--with-jpeg-includes=/opt/mozjpeg/include --with-jpeg-libraries=/opt/mozjpeg/lib64 && \
make -j4 V=0 && make install && \
rm -rf /tmp/*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.