我正试图在AWS Lambda上部署我的码头集装箱。但是,我在代码中使用了依赖于pdf2image的poppler包。要安装poppler,我需要在Dockerfile中插入以下行。
RUN apt-get install -y poppler-utils这是dockerfile的完整视图。
FROM ubuntu:18.04
RUN apt-get update
RUN apt-get install -y poppler-utils
RUN apt-get install python3 -y
RUN apt-get install python3-pip -y
RUN pip3 install --upgrade pip
WORKDIR /
COPY app.py .
COPY requirements.txt .
RUN pip3 install -r requirements.txt
ENTRYPOINT [ "python3", "app.py" ]但是,要在Lambda上部署,我需要为Lambda使用AWS基python映像。这是我试图重写上面的dockerfile来使用Lambda基本图像的尝试。
FROM public.ecr.aws/lambda/python:3.6
# Cannot run the follow lines: apt-get: command not found
# RUN apt-get update
# RUN apt-get install -y poppler-utils
COPY app.py .
COPY requirements.txt .
RUN pip install -r requirements.txt
CMD ["app.handler"]根据上面的dockerfile,您可以看到apt命令无法运行。可以理解,因为它不是像我之前做的那样来自于ubuntu的图像。我的问题是,如何在Lambda基础映像中安装poppler?
发布于 2022-01-24 11:17:33
它使用yum包管理器,因此您可以执行以下操作:
FROM public.ecr.aws/lambda/python:3.6
RUN yum install -y poppler-utilshttps://stackoverflow.com/questions/70832297
复制相似问题