Skip to content

Instantly share code, notes, and snippets.

@tayfun
Created October 31, 2018 10:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tayfun/5c72763b8b30bb73fdfeee3896cdc3ea to your computer and use it in GitHub Desktop.
Save tayfun/5c72763b8b30bb73fdfeee3896cdc3ea to your computer and use it in GitHub Desktop.
Dockerfile for building docker image with vips manually installed
# Because we now use shared libraries, we need to install them in the correct OS.
FROM lambci/lambda:build-nodejs8.10
# General development tools
RUN yum makecache fast
RUN yum -y groupinstall 'Development Tools'
RUN yum -y install gcc-c++ findutils
# Packages needed specifically for compiling Sharp
RUN yum -y install glib2-devel expat-devel libpng-devel libjpeg-turbo-devel zlib-devel giflib-devel libtiff-devel libexif-devel libwebp-devel fftw-devel lcms2-devel
# BMP support is provided by ImageMagick.
RUN yum -y install ImageMagick-devel
# librsvg for supporting svg files, are not in Amazon package repo so we build
# and install manually.
# EDIT: Commented out because of too many requirements. svg probably does not need resize
# from Sharp anyway.
# RUN curl https://sh.rustup.rs -sSf | sh -s -- -y && export PATH="$HOME/.cargo/bin:$PATH" && yum -y install wget && wget http://ftp.gnome.org/pub/GNOME/sources/librsvg/2.44/librsvg-2.44.7.tar.xz && tar xvfJ librsvg-2.44.7.tar.xz && cd librsvg-2.44.7 && ./configure --prefix=/usr && make && make install
# Note that we cannot use 8.7.0 because it is not compatible with glib
# installed in Amazon Linux which is extremely old. 8.7.1 should have a fix for
# that with https://github.com/libvips/libvips/issues/1117
RUN mkdir -p /build/libvips && curl -Ls https://github.com/libvips/libvips/releases/download/v8.6.5/vips-8.6.5.tar.gz | tar xzC /build/libvips --strip-components=1
RUN cd /build/libvips && ./configure && make && make install
RUN mkdir -p /build/lambda
WORKDIR /build/lambda
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment