Skip to content

Instantly share code, notes, and snippets.

@tayfun
Created October 31, 2018 10:31
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/4e6535e6627987769a45202c7c0b191a to your computer and use it in GitHub Desktop.
Save tayfun/4e6535e6627987769a45202c7c0b191a to your computer and use it in GitHub Desktop.
Makefile for building lambda for Sharp with bmp support
SHELL := /bin/bash
all: docker-image compile package
docker-image:
docker build --tag lambci/lambda:vips .
compile-origin-response:
# `compile-*` is only run so that we have node_modules dir with
# dependencies that can be packaged into a zip file with `package` target
# below.
docker run --rm --volume ${PWD}/lambda/origin-response-function:/build/lambda lambci/lambda:vips /bin/bash -c "npm init -f -y; PKG_CONFIG_PATH=/usr/local/lib/pkgconfig/ npm install sharp querystring raven --save; npm install --only=prod; cp /usr/local/lib/libvips.so.42 ./lib; cp /usr/local/lib/libvips-cpp.so.42 ./lib; cp /usr/lib64/libfftw3.so.3 /build/lambda/lib/; cp /usr/lib64/libwebp.so.4 /build/lambda/lib/; cp /usr/lib64/libexif.so.12 /build/lambda/lib/"
package-origin-response:
mkdir -p dist && cd lambda/origin-response-function && zip -FS -q -r ../../dist/origin-response-function.zip * && cd ../..
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment