trying to create a layer for my lambda function which uses the pyzbar library, which requires the zbar shared library as dependency, to be downloaded separately, and can't be installed with pip. My Dockerfile looks like this:
FROM public.ecr.aws/lambda/python:3.8
COPY requirements.txt .
COPY lambda_function.py .
RUN pip install --upgrade pip &&\
pip install -r requirements.txt &&\
yum makecache &&\
yum -y install zbar
CMD [ "lambda_function.lambda_handler"]
and my requirements.txt like this
opencv-python-headless
pyzbar
pyzbar[scripts]
I'm getting the error
No package zbar available
I'm getting the same error when I replace "zbar" with a number of other package names, e.g. libzbar0, libzbar-dev, zbar-tools, etc
zbar
is not included in the default amazon linux repo, so you need to add the epel repo.
FROM public.ecr.aws/lambda/python:3.8
COPY requirements.txt .
COPY lambda_function.py .
RUN pip install --upgrade pip &&\
pip install -r requirements.txt &&\
yum -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm &&\
yum makecache &&\
yum -y install zbar
CMD [ "lambda_function.lambda_handler"]