serverless-python-requirements icon indicating copy to clipboard operation
serverless-python-requirements copied to clipboard

serverless docker images (python 3.9)

Open gmetzker opened this issue 3 years ago • 10 comments
trafficstars

I'm wondering if you have considered publishing your own set of python docker images for use in your plugin? Lambci lacks support for python 3.9, despite a PR and several requests. Others are wondering what the status of the project is. It seems they have not updated their other docker images in 10 months or so.

It would be super helpful to have a verified set of images on docker hub from a trusted source.

gmetzker avatar Nov 23 '21 17:11 gmetzker

If it helps, I switched to mlupin/docker-lambda:python3.9-build

ronkorving avatar Dec 03 '21 02:12 ronkorving

how do you "switch" to another image? All I am doing is sls deploy, and it looks for lamci's non-existing 3.9 build image. Where do I specify the docker image for building?

sscarduzio avatar Jan 03 '22 09:01 sscarduzio

@sscarduzio :

custom:
  pythonRequirements:
    dockerImage: mlupin/docker-lambda:python3.9-build

See readme.

ronkorving avatar Jan 04 '22 01:01 ronkorving

But, we need some kind of "official" support for those docker images of new python versions.

mhihasan avatar Jan 24 '22 10:01 mhihasan

@mhihasan despite repo's name it's not some kind of official Amazon AWS repo. Just somebody who created docker images that replicate AWS lambda environment. mlupin/docker-lambda is as official as this one is.

This repo was not touched over a year even though owner appears to contribute to other of his repos. I think we are told to move on and he is not interested in maintaining it.

takeda avatar Feb 15 '22 06:02 takeda

can we just switch to SAM CLI build images? They will always have support https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-image-repositories.html

bryantbiggs avatar May 28 '22 23:05 bryantbiggs

I've been successful using dockerImage: public.ecr.aws/sam/emulation-python3.9:latest.

jcranendonk avatar Jun 04 '22 18:06 jcranendonk

Good stuff, but there are some downsides though, comparing to mlupin images. E.g. when pip install psutil on AWS image: error: command 'gcc' failed: No such file or directory

zhemaituk avatar Jun 05 '22 12:06 zhemaituk

How about public.ecr.aws/sam/build-python3.9 ? It works for me.

tooruuetani avatar Jun 13 '22 05:06 tooruuetani

@tooruuetani thank you, works like a charm.

My config for aarch64 build:

provider:
  name: aws
  runtime: python3.9
  architecture: arm64
custom:
  pythonRequirements:
    slim: true
    dockerizePip: true
    dockerRunCmdExtraArgs: [ '--platform', 'linux/arm64/v8' ]
    dockerImage: public.ecr.aws/sam/build-python3.9:latest-arm64

zhemaituk avatar Jun 20 '22 16:06 zhemaituk

Hey everyone, I believe the best way would to be switch to official AWS images as defaults for building. PR #724 proposed that change, but please note that it will require a major version bump as it will be considered a breaking change. I've tested different scenarios for packaging, but any feedback is more than welcome

pgrzesik avatar Sep 27 '22 16:09 pgrzesik