lambci / docker-lambda

Docker images and test runners that replicate the live AWS Lambda environment
MIT License
5.84k stars 431 forks source link

How can I build image for python3.9 runtime? #349

Closed mhihasan closed 2 years ago

mhihasan commented 2 years ago

I am using python3.9 runtime, and that's why I need lambci/lambda:build-python3.9 image. As currently it is not available, I would like to build from myself and use this until any officail release for python3.9.

How could I do that? Thanks

senor-coder commented 2 years ago

AWS has a docker image for python 3.9 -> public.ecr.aws/lambda/python:3.9 . Does this solve your problem ?

mhihasan commented 2 years ago

This image requires requires the handler name to be the first argument of entrypoint, but I want to build lambda layer using that,

docker run --rm  --volume "$PWD:/var/task" --workdir /var/task  public.ecr.aws/lambda/python:3.9 pip install -Ur requirements.txt --target .layers/demo/python

This command throws error,

entrypoint requires the handler name to be the first argument
senor-coder commented 2 years ago

@mhihasan You can try out the images that I have published for python 3.9 in the meantime.

docker run --rm --volume "$PWD:/var/task" --workdir /var/task senorcoder/aws-lambda-env:python3.9_build pip install -Ur requirements.txt --target .layers/demo/python

Runtime: senorcoder/aws-lambda-env:python3.9
Build  : senorcoder/aws-lambda-env:python3.9_build

Repository Reference: https://github.com/senor-coder/aws-lambda-pyruntime

mhihasan commented 2 years ago

Thanks a lot, it works. 👍