This option would come in handy when one needs to have a custom image (usually built on top of lambci/lambda ones) for requirements packaging.
The use case I came across was when I needed to run my serverless Python function that uses pymssql in Python 3.6 environment. Unfortunately, the project currently does not provide a pre-built wheel for Python 3.6 in Linux environment - see https://github.com/pymssql/pymssql/issues/473
So my workaround for this is to build pymssql with the environment variable export PYMSSQL_BUILD_WITH_BUNDLED_FREETDS=1, included in a Dockerfile as such:
FROM lambci/lambda:build-python3.6
ENV PYMSSQL_BUILD_WITH_BUNDLED_FREETDS 1
Built the image, and pushed to Docker Hub, specified in custom.pythonRequirements.dockerImage option supported by this plugin. Everything works great.
However, this solution would be more portable and flexible for when the use case prohibits the use of Docker Hub, for whatever reasons. If there's an option to allow dockerImage to be sourced from a Dockerfile directly, basically adding one step to first build the image using supplied Dockerfile, tag it with serverless service name and stage and runtime for matching convention with currently supplied set of lambci/lambda images, and then just follow the existing steps to package pip requirements.
Oooh, that's a good idea, having to maintain your own image is a nuisance and this would help a ton. I think I'd want to add a dockerfile option which is mutually exclusive with the dockerImage option.
Most helpful comment
Oooh, that's a good idea, having to maintain your own image is a nuisance and this would help a ton. I think I'd want to add a
dockerfileoption which is mutually exclusive with thedockerImageoption.