Created
November 21, 2021 11:53
-
-
Save tekumara/16ccf7b25a88ee1f6cab220c6db4570a to your computer and use it in GitHub Desktop.
Build a python zip file with dependencies for AWS lambda
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM public.ecr.aws/lambda/python:3.8 as builder | |
RUN yum install -y zip | |
WORKDIR /var/task/ | |
COPY setup.py pyproject.toml ./ | |
COPY src ./src/ | |
RUN pip install --no-cache-dir . --target dist | |
WORKDIR /var/task/dist | |
RUN zip --quiet -r9X /var/task/function.zip . | |
FROM scratch | |
COPY --from=builder /var/task/function.zip / |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
To build run: