lambci / docker-lambda

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

feat: Add python3.9 runtime #348

Open GordonSo opened 2 years ago

GordonSo commented 2 years ago

Now that amazon added support for Python 3.9 it would be great to add Python 3.9 support https://aws.amazon.com/tw/about-aws/whats-new/2021/08/aws-lambda-adds-support-python-3-9/

This is an attempt to mimic: https://github.com/lambci/docker-lambda/commit/a94337ae2410a94a9ac878622eb82b26bc385a92#diff-0af1966588ced06e3143ae720245c9b7aeaae213c6921c12c742a166679cc505

But this has a dependency on the image being added to s3 see: https://github.com/lambci/lambci/issues/138

jaidisido commented 2 years ago

Any chance a maintainer can have a look at this PR please?

mLupine commented 2 years ago

Just dropping by to let you know that I've created a fork of the project with Python 3.9 and ARM64 support. See my comment here for more details.

kukushking commented 2 years ago

Hi @mhart, lambda added 3.9 in Aug this year -- would be great if you could review & merge this.

arhant commented 2 years ago

Hi @mhart can we please review this and merge? Thanks

vhuliai-beetroot commented 2 years ago

Hi! @mhart any chance this PR to be reviewed and merged? Thanks

Strateus commented 2 years ago

+1 for python 3.9

BassplayerPatrick commented 2 years ago

Can someone (@mhart ?) please approve and merge this PR? It's taking too long

takeda commented 2 years ago

Would be possible to add python3.10 so when AWS would add support for it in lambda, this container would be already available?

brianantonelli commented 2 years ago

Merge pleeeaassseee

mrnonz commented 2 years ago

Why we not merge this PR?

takeda commented 2 years ago

Looks like somebody already forked this project and solved it several months ago:

https://github.com/mLupine/docker-lambda

https://hub.docker.com/r/mlupin/docker-lambda

This repo hasn't been touched in a year now.

BassplayerPatrick commented 1 year ago

Since this repo seems to be dead for almost 2 years now, My colleague and I went searching for other solutions. One solution was to use the fork, created by mlupine, but because that's also a one-man-operation and the last update was 9 months ago, we searched further and guess what? We seem to have found a solution in AWS!! Recently AWS added support for Lambda Container Images and provides base images for Lambda. Look here: https://aws.amazon.com/blogs/aws/new-for-aws-lambda-container-image-support for all information and documentation.

GordonSo commented 1 year ago

Since this repo seems to be dead for almost 2 years now, My colleague and I went searching for other solutions. One solution was to use the fork, created by mlupine, but because that's also a one-man-operation and the last update was 9 months ago, we searched further and guess what? We seem to have found a solution in AWS!! Recently AWS added support for Lambda Container Images and provides base images for Lambda. Look here: https://aws.amazon.com/blogs/aws/new-for-aws-lambda-container-image-support for all information and documentation.

That's correct, and if you use serverless deployment, there is an ECR section under provider:

  ecr:
    images:
      baseimage:
        buildArgs:
        cacheFrom:
        path: "./"
        file: "Dockerfile"
        platform: linux/amd64  # see: https://github.com/aws/aws-lambda-base-images/issues/26

which will build and upload the docker image into ECR service for you. And the function handlers can reference the container image with a command path in a similar way as how it'd reference the code path previously.

*You'd need docker available on the deployment pipeline agent. **Also remember to set up a life-policy rule to tidy up images from previous deployments on ECR.

The serverless page for referencing-container-image-as-a-target has more details.

The advantage is that you can build and use one of AWS's images or customize your own and maintain them on ECR service. As a side-effect, you'd also overcome the 250Mb size limit that AWS Lambda has to offer (since the container route supports up to 10Gb). But I trust that there will be a longer cold-start using an image, so the container option may not be for everybody depending on the non-functional requirements.

karkir0003 commented 1 year ago

@GordonSo pretty please with cherry sprinkles on top can we merge this PR in. This PR is blocking me from testing mocking a lambda on python 3.9 runtime with the moto framework