infra: lambda in docker#20
Merged
Merged
Conversation
Contributor
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Migrate Lambda Deployment from ZIP to Docker Container
Summary
Migrated the GLAD Stack Lambda function deployment from ZIP-based packaging to Docker container images. This change provides better dependency management, larger size limits (10GB vs 250MB), and improved local testing capabilities with full Lambda Runtime Interface Emulator support.
Implementation Details
New Features
1. Multi-Stage Dockerfile
Dockerfilegolang:1.24.0-alpinebase image-ldflags="-s -w"for minimal binary sizepublic.ecr.aws/lambda/provided:al2023base image2. Enhanced Task Automation
Taskfile.ymltask build:docker- Build Docker image locally for testingtask build:docker:test- Test Docker image with Lambda Runtime Interface Emulatortask deploy- Now uses Docker-based deployment (CDK handles build automatically)task cdk:deploy,task cdk:synth,task cdk:diff- Removed ZIP packaging dependencies3. Automated ECR Integration
Key Changes
Infrastructure (CDK)
deployments/app/cdk.goawslambda.NewFunction()with ZIP-basedawslambda.AssetCode_FromAsset()awslambda.NewDockerImageFunction()withawslambda.DockerImageCode_FromImageAsset()Build Process
go build+zipcommandsDeployment Workflow
CDK now automatically:
Testing
Local Testing
Deployment Testing
Comparison: ZIP vs Docker
Benefits
Prerequisites