Initial Implementation for adding custom container support #1611
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This is an initial proof of concept of adding custom container support to Serverless Offline. This PR was opened so we can discuss the implementation to hopefully land on something that can be merged.
provider.ecr.images
section.image
instead of ahandler
The current implementation has a few limitations and drawbacks:
These can be changed from the default settings which would break this code since there is no way at the moment to tell this code how the Dockerfile has been configured. However as a workaround the code in the container could just detect the SLS_OFFLNE environmental variable and configure itself in a manner that would work.
The intention is we would incrementally add support for more configurations and use cases over time. Rather than waiting for the perfect implementation which covers all use cases which in my view would increase likelihood this project just ends up not supporting any use case.
Motivation and Context
For those who have moved to using containers with lambda then currently you cannot use serverless offline since it only supports handlers uploaded as a .zip file which forces workarounds such as two configuration files one for production and one for development.
You can read more here #1324
How Has This Been Tested?
At the moment I have tested against our own project which already specified a lambda and a Dockerfile since this is a POC. But when I make this code production ready I aim to add a suite of tests to the ones which already exist here.
The majority of the code has been untouched so it should work.
Screenshots (if appropriate):