我正在尝试构建一个 docker 映像,该映像将作为函数部署在 AWS Lambda 上。能够成功构建和测试图像,但当我尝试在函数中导入 OpenCV 时遇到问题。
当我从 app.py 中删除 import 语句时,我没有遇到这个问题
我面临的错误 -
{"errorMessage": "Unable to import module 'app': libGL.so.1: cannot open shared object file: No such file or directory", "errorType": "Runtime.ImportModuleError"}
Run Code Online (Sandbox Code Playgroud)
我的 Dockerfile -
# Define custom function directory
ARG FUNCTION_DIR="/function"
FROM python:3.9 as build-image
# Include global arg in this stage of the build
ARG FUNCTION_DIR
# Install aws-lambda-cpp build dependencies
RUN apt-get update && \
apt-get install -y \
g++ \
make \
cmake \ …Run Code Online (Sandbox Code Playgroud)