Last active
December 27, 2023 19:02
-
-
Save nickovs/f097c577df90bdeb98ea0127c60e3462 to your computer and use it in GitHub Desktop.
A script for building a version of the Zbar library suitable for running in an AWS Lambda instance
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 | |
# Clear out old images | |
[ -d "lib" ] && rm -r lib | |
cat <<EOF > tmp_recipe.sh | |
# This is the actual container-side recipe | |
yum groupinstall -y "Development Tools" | |
cd /root | |
git clone https://github.com/mchehab/zbar.git | |
cd zbar | |
autoreconf -vfi | |
./configure --prefix=/usr --without-xshm --without-xv --without-jpeg --without-imagemagick --without-gtk --without-python --without-qt --disable-video | |
make | |
mkdir -p /build/lib | |
cp -a zbar/.libs/libzbar.so* /build/lib | |
EOF | |
# Run the recipe in an Amazon Linux 2 container | |
docker run --rm -it -v $(pwd):/build amazonlinux:2 bash /build/tmp_recipe.sh | |
rm tmp_recipe.sh |
@yopicon2 I've not tried converting this into a layer, primarily because layers hugely slows down the Lambda container start time. Instead I used the fix that is in NaturalHistoryMuseum/pyzbar#41 which the maintainers merged into one of their branches some time ago but have never got around to releasing :-(
Thanks very much!!!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi! thanks for the code. do you know how to convert this files into a layer? my lamda function keeps saying "errorMessage": "Unable to import module 'lambda_function': No module named 'pyzbar'"