https://pantsbuild.org/ logo
#general
Title
# general
b

bland-father-19717

02/05/2022, 7:40 AM
I am developing some Python applications using AWS Lambda. Can I build a Docker image using pants to deploy a Python Lambda function to a container image?
I changed the Dockerfile and BUILD file to the following and was able to confirm that it was working as intended. Lambdex and Pex is fantastic tools !!!
Dockerfile
Copy code
FROM public.ecr.aws/lambda/python:3.8

WORKDIR /build
RUN yum install unzip -y
COPY src.python.lambda_sample/lambda.zip /build
RUN unzip /build/lambda.zip -d /app
WORKDIR /app
CMD ["/app/lambdex_handler.handler"]
BUILD
Copy code
python_awslambda(
    name="lambda",
    runtime="python3.8",
    dependencies=[
        ":lib",
    ]
    handler="main.py:lambda_handler"
)

docker_image(
    name="my_image",
    dependencies = ["src/python/lambda_sample:lambda"],
)
πŸš€ 1
❀️ 1
h

hundreds-father-404

02/05/2022, 2:29 PM
I'm so glad you got this working! Yay πŸ™‚ Would you be comfortable with us tweeting some of your above message? It helps us to get out the word about features like AWS Lambda support. No worries if not!
b

bland-father-19717

02/05/2022, 2:38 PM
Would you be comfortable with us tweeting some of your above message? It helps us to get out the word about features like AWS Lambda support. No worries if not!
Of course it’s okay!
❀️ 1
https://github.com/pantsbuild/pants/issues/14373 I created an issue just in case and closed it.
h

hundreds-father-404

02/05/2022, 3:09 PM
Good idea! That helps future users to search this issue
πŸ‘ 2
h

happy-kitchen-89482

02/05/2022, 3:45 PM
Thanks! Glad this worked.
I expected it to, but you never know
πŸ‘ 1
b

busy-vase-39202

02/07/2022, 6:44 PM
Hi @bland-father-19717! Thanks for allowing us to tweet that. Is there a personal twitter account you'd like us to credit that to?
b

bland-father-19717

02/07/2022, 6:49 PM
Hi ! Twitter ID: @kenkman621
🐦 1
πŸ™Œ 1
b

busy-vase-39202

02/07/2022, 6:55 PM
Done! Thank you. πŸ™‚
πŸ‘ 1
❀️ 1
b

bland-father-19717

02/08/2022, 2:23 AM
Thank you too !
b

busy-vase-39202

02/08/2022, 3:05 AM
Your tweet about it was very kind, if Google Translate is accurate. πŸ™‚
πŸ‘ 1
7 Views