Ape*_*zzz 6 python ubuntu docker aws-lambda poppler-utils
我正在尝试在 AWS Lambda 上部署我的 docker 容器。但是,我pdf2image在代码中使用依赖于poppler. 要安装poppler,我需要在 Dockerfile 中插入以下行。
RUN apt-get install -y poppler-utils
Run Code Online (Sandbox Code Playgroud)
这是 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" ]
Run Code Online (Sandbox Code Playgroud)
但是,要在 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"]
Run Code Online (Sandbox Code Playgroud)
根据上面的dockerfile可以看到apt-get命令无法运行。可以理解,因为它不像我之前那样来自 ubuntu 映像。我的问题是,如何poppler在 Lambda 基础映像中安装?
Che*_*Liu 17
它使用 yum 包管理器,因此您可以执行以下操作:
FROM public.ecr.aws/lambda/python:3.6
RUN yum install -y poppler-utils
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3447 次 |
| 最近记录: |