Is there a way to setup a function that will be de...
# help
d
Is there a way to setup a function that will be deploy from a Dockerfile instead of a remote docker repository? With cloudformation we can deploy a lambda from an image but this requires to have a stack that create the repo, then docker build/push to the ECR and then feed this url to another cloudformation (what involves human interaction between both stacks). Is this somehow easier with SST? Ideally, SST would “build and push” the image as part of the deploy in between stacks provisioning. In short, something the same way than SAM:
AWS SAM template
The second set of required data is in the Metadata section that helps AWS SAM manage the container images. When a container is created, a new tag is added to help identify that image. By default, Docker uses the tag, latest. However, AWS SAM passes an explicit tag name to help differentiate between functions. That tag name is a combination of the Lambda function resource name, and the DockerTag value found in the Metadata. Additionally, the DockerContext points to the folder containing the function code and Dockerfile identifies the name of the Dockerfile used in building the container image.
In addition to changes in the template.yaml file, AWS SAM also uses the Docker CLI to build container images. Each Lambda function has a Dockerfile that instructs Docker how to construct the container image for that function. The Dockerfile for the HelloWorldFunction is at hello-world/Dockerfile.
Source: https://aws.amazon.com/blogs/compute/using-container-image-support-for-aws-lambda-with-aws-sam/
t
Right now SST doesn't do anything to make this easier
Being realistic I don't think we'll be able to prioritize this functionality, it's tough to improve on top of the docker experience
d
It seems it is possible from CDK to provide a docker file and get it build / push to ECR. I’ll try with that.