Last active
March 29, 2020 19:29
-
-
Save jweisman/1cae6ad7d1c3cce8104488913754a6de to your computer and use it in GitHub Desktop.
Dockerfile to build dependencies for serverless-iiif in AWS Lambda
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
if [[ ! -d "dependencies/nodejs" ]] ; then | |
echo 'Dependencies directory does not exist' | |
exit 1 | |
fi | |
cd "dependencies/nodejs" | |
rm -rf node_modules/ | |
# Install dependencies using npm ci to preserve package-lock versions | |
npm ci | |
cd ../ | |
rm -rf lib | |
mkdir -p lib | |
# Copy linked libraries into lib dir | |
ldd nodejs/node_modules/sharp/build/Release/sharp.node | grep "=> /" | awk '{print $3}' | xargs -I '{}' cp -v '{}' lib | |
# Copy ImageMagick coders/filters | |
cp -r /usr/lib64/ImageMagick* lib/ImageMagick | |
# Copy JP2 Coder | |
ldd lib/ImageMagick/modules*/coders/jp2.so | grep "=> /" | awk '{print $3}' | xargs -I '{}' cp -v '{}' lib |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM lambci/lambda:build-nodejs12.x | |
RUN yum install -y \ | |
https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm \ | |
https://rpms.remirepo.net/enterprise/remi-release-7.rpm | |
RUN yum install -y \ | |
ImageMagick-devel openjpeg-devel jasper-devel glib2-devel \ | |
expat-devel libtiff-devel openslide-devel giflib-devel libpng-devel \ | |
libjpeg-turbo-devel libgsf-devel poppler-glib librsvg2-devel libimagequant \ | |
libgsf-devel libexif-devel wget nodejs python3 && \ | |
alias python=python3 | |
RUN yum groupinstall -y "Development Tools" | |
ENV VIPS_VERSION 8.9.0 | |
RUN cd /tmp && \ | |
wget https://github.com/libvips/libvips/releases/download/v${VIPS_VERSION}/vips-${VIPS_VERSION}.tar.gz && \ | |
tar xf vips-${VIPS_VERSION}.tar.gz && \ | |
cd vips-${VIPS_VERSION} && \ | |
./configure --with-magickpackage=ImageMagick && \ | |
make && \ | |
make install && \ | |
echo "/usr/local/lib" >> /etc/ld.so.conf.d/usrlocal.conf && \ | |
ldconfig | |
COPY build.sh /tmp | |
RUN chmod u+x /tmp/build.sh | |
WORKDIR /tmp | |
CMD "./build.sh" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment