Description
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 pymssql/pymssql#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.