diff --git a/Makefile b/Makefile index c8bdad4..c9b69e1 100644 --- a/Makefile +++ b/Makefile @@ -10,6 +10,7 @@ clean: LAMBDA_S3_BUCKET := buildkite-aws-stack-lox LAMBDA_S3_BUCKET_PATH := / +export CGO_ENABLED := 0 ifdef BUILDKITE_BUILD_NUMBER LD_FLAGS := -s -w -X version.Build=$(BUILDKITE_BUILD_NUMBER) @@ -25,17 +26,18 @@ endif build: handler.zip -handler.zip: lambda/handler +handler.zip: bootstrap zip -9 -v -j $@ "$<" -lambda/handler: lambda/main.go +bootstrap: lambda/main.go docker run \ --env GOCACHE=/go/cache \ + --env CGO_ENABLED \ --user $(USER) \ --volume $(PWD):/app \ --workdir /app \ --rm golang:1.19 \ - go build -ldflags="$(LD_FLAGS)" -buildvcs="$(BUILDVSC_FLAG)" -o lambda/handler ./lambda + go build -ldflags="$(LD_FLAGS)" -buildvcs="$(BUILDVSC_FLAG)" -tags lambda.norpc -o bootstrap ./lambda lambda-sync: handler.zip aws s3 sync \ diff --git a/template.yaml b/template.yaml index 44ee2c9..ab45a5e 100644 --- a/template.yaml +++ b/template.yaml @@ -190,8 +190,10 @@ Resources: Role: !If [ CreateRole, !GetAtt ExecutionRole.Arn, !Ref AutoscalingLambdaExecutionRole ] PermissionsBoundary: !If [ SetRolePermissionsBoundaryARN, !Ref RolePermissionsBoundaryARN, !Ref "AWS::NoValue" ] Timeout: 120 - Handler: handler - Runtime: go1.x + Handler: bootstrap + Runtime: provided.al2 + Architectures: + - x86_64 MemorySize: 128 Environment: Variables: