Hi <@U01JVDKASAC> and <@U01J5Q8HV5Z>, is it possib...
# sst
d
Hi @Frank and @Jay, is it possible to build docker image runtime and specify that for the Lambda?
Like here.
f
Hey @Dillon Peterson, it’s on the roadmap - https://github.com/serverless-stack/serverless-stack/discussions/177
Can you share a bit about ur use case? That’d help us prioritize it.
d
Would be for ML Model Deployment (inference endpoint) via Lambda.
f
I see.. are you building the docker image, or reusing an existing public ECR image?
d
Building a docker image.
f
We’d need to figure out how to run the lambda code locally when running inside
sst start
hmm.. may I trouble you for a sample repo with your setup? I feel I need to play around with it and figure out: • how to run the handler locally; and • how to auto-rebuild the handler on code change when running inside
sst start
Btw, I thought about it more, and updated the discussion with more details.
d
I don't currently have a sample repo, just got started with this. 😬
This essentially is what I'm aiming to accomplish with SST.
f
I see. You can actually do what’s described in the blog post in SST. Follow all the steps till
docker push
the image to ECR. And then in ur SST app, do something like this to create a Lambda function with docker runtime: (I haven’t tested this code.)
Copy code
import * as ecr from '@aws-cdk/aws-ecr';

const repo = ecr.Repository.fromRepositoryName(this, Repo', 'bert-lambda');

new lambda.DockerImageFunction(this, 'ECRFunction', {
  code: lambda.DockerImageCode.fromEcr(repo),
});
Like I mentioned in the discussion,
sst start
won’t be able to auto rebuild (ie. docker build) the docker image on code changes. That is not supported yet.
d
Many thanks @Frank!! I appreciate it!~