I am following this tutorial to get playwright installed on a docker container which I am then trying to deploy to an AWS Lambda function: https://tech.smartshopping.co.jp/lambda-container-playwright
After following all of the steps I keep getting the following error:
╔══════════════════════════════════════════════════════╗
║ Host system is missing dependencies to run browsers. ║
║ Missing libraries: ║
║ libasound.so.2 ║
╚══════════════════════════════════════════════════════╝
This is my docker file:
FROM public.ecr.aws/lambda/python:3.9-arm64
ENV PLAYWRIGHT_BROWSERS_PATH=/var/task/bin
RUN yum -y update && yum -y install libXScrnSaver gtk2 gtk3 alsa-lib.x86_64
RUN mkdir /var/task/bin
COPY /app/main.py requirements.txt ./
RUN python3.9 -m pip install --upgrade pip && \
python3.9 -m pip install -r requirements.txt && \
python3.9 -m playwright install chromium
# Command can be overwritten by providing a different command in the template directly.
CMD ["main.lambda_handler"]
I have tried installing the missing library in the first RUN command changing:
RUN yum -y update && yum -y install libXScrnSaver gtk2 gtk3 alsa-lib.x86_64
to:
RUN yum -y update && yum -y install libXScrnSaver libasound.so.2 gtk2 gtk3 alsa-lib.x86_64
but that just resulted in the same error. so I tried installing the lib in the third RUN command changing:
RUN python3.9 -m pip install --upgrade pip && \
python3.9 -m pip install -r requirements.txt && \
python3.9 -m playwright install chromium
to:
RUN python3.9 -m pip install --upgrade pip && \
python3.9 -m pip install -r requirements.txt && \
python3.9 -m playwright install chromium && \
python3.9 -m pip install libasound.so.2
but that again just resulted in the same error being produced.
How can I install the missing library in order to fix the error?
EDIT:
Fixed by changing this line:
RUN yum -y update && yum -y install libXScrnSaver libxtst6 gtk2 gtk3 alsa-lib.x86_64
to:
RUN yum -y update && yum -y install libXScrnSaver libxtst6 gtk2 gtk3 alsa-lib.aarch64
But now getting the error:
pid=68\n[pid=68][err]
/var/task/bin/chromium-1005/chrome-linux/chrome:
/lib64/libm.so.6: version `GLIBC_2.27' not found
(required by /var/task/bin/chromium-1005/chrome-linux/chrome)\n
[pid=68][err]
/var/task/bin/chromium-1005/chrome-linux/chrome:
/lib64/libm.so.6: version `GLIBC_2.29' not found
(required by /var/task/bin/chromium-1005/chrome-linux/chrome)