-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add eks and ecs exec types for golang #274
Conversation
aeba919
to
92eb76e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nothing blocking, but some improvements in the comments
|
||
WORKDIR /usr/src/app | ||
ENV GOOS=linux GOARCH=amd64 CGO_ENABLED=0 | ||
COPY . . |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This makes the layer caching suboptimal - can you copy from the lambda one (where it add go.mod first before the go mod
stuff, then adds the rest of the files before building).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so the previous pr you had put in for the dockerfile didnt fully work until i made some of the changes which are now reflected in both spots. I can try to make the change your suggesting but if i remember correctly, it wasnt building the image as expected
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also with the way its built and go being a statically linked isnt it just building the binary itself and nothing else? so the entire contents of the image is just the binary?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, the layer caching is mostly for build times and can be a huge help for CI/CD cases but doesn't affect the runtime image in this case.
pkg/lang/golang/aws_runtime/aws.go
Outdated
newFileContent := oldFileContent | ||
|
||
oldNodeContent := nodeToComment | ||
newNodeContent := commentRegex.ReplaceAllString(oldNodeContent, "// $1") | ||
|
||
//TODO: investigate correctly indenting code | ||
dispatcherCode := fmt.Sprintf(` | ||
// Begin - Added by Klotho | ||
chiLambda := chiadapter.New(%s) | ||
handler := func(ctx context.Context, req events.APIGatewayProxyRequest) (events.APIGatewayProxyResponse, error) { | ||
return chiLambda.ProxyWithContext(ctx, req) | ||
} | ||
lambda.StartWithContext(context.Background(), handler) | ||
//End - Added by Klotho`, routerName) | ||
|
||
newNodeContent = newNodeContent + dispatcherCode | ||
newFileContent = strings.ReplaceAll( | ||
newFileContent, | ||
oldNodeContent, | ||
newNodeContent, | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: there's a much better way to do this now with f.ReplaceNodeContent
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this was copy paste from the initial code, just moved it into runtime, so let me refactor a bit to clean it up
|
• Does any part of it require special attention?
• Does it relate to or fix any issue? closes https://github.com/klothoplatform/klotho-history/issues/469
Images are only 25-35 MB for EKS and ECS with golang.
Adding new dockerfile and doing some refactors to the expose plugin to not be lambda specific/moving that into runtime
exporting aws service names from the provider so they can be used in the runtime
Standard checks