-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Open
Labels
Description
Describe your idea/feature/enhancement
Docker just added support for multiple build contexts. This could be especially useful in multi-function lambda deployments where common code needs to be used across multiple functions. For example:
root_folder
├── function1
│ ├── function1_code.py
│ └── Dockerfile
├── function2
│ ├── function2_code.py
│ └── Dockerfile
├── common_libraries
│ └── common.py
├── samconfig.toml
└── template.yaml
In this scenario, it would be nice to have sam build effectively run docker build --build-context common=../common_libraries function1. Then all the Dockerfiles could be updated to pull the common libraries instead of having to copy common.py into each function's folder.
Proposal
Add support for multiple docker build contexts. Potentially through the DockerBuildArgs field in the template.
Things to consider:
- Will this require any updates to the SAM Spec
Additional Details
https://www.docker.com/blog/dockerfiles-now-support-multiple-build-contexts/
Reactions are currently unavailable