Install package with Conda on AWS ECR and run it with Lambda

Viewed 53

I created an image with Docker and push it to AWS ECR. Then I will run the image with Lambda.

This is my Dockerfile

FROM ubuntu:18.04
ENV PATH="/root/miniconda3/bin:${PATH}"
ARG PATH="/root/miniconda3/bin:${PATH}"
RUN apt-get update

RUN apt-get install -y wget && rm -rf /var/lib/apt/lists/*

RUN wget \
    https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh \
    && mkdir /root/.conda \
    && bash Miniconda3-latest-Linux-x86_64.sh -b

RUN conda create -n top2vec python=3.9
RUN conda install -c conda-forge hdbscan

COPY requirements.txt ./
RUN python3.9 -m pip install -r requirements.txt
COPY app.py ./
CMD ["app.lambda_handler"]

The build is successful, but when I run it on Lambda. I got this error:

IMAGE\tLaunch error: exec: "app.lambda_handler": executable file not found in $PATH\tEntrypoint: []\tCmd: [app.lambda_handler]\tWorkingDir: []END

I don't know why Lambda cannot find the entry point file which is app.py

0 Answers
Related