File tree Expand file tree Collapse file tree 14 files changed +104
-27
lines changed Expand file tree Collapse file tree 14 files changed +104
-27
lines changed Original file line number Diff line number Diff line change 2020 go-version : ' ~1.18.2'
2121
2222 - name : Build
23+ env :
24+ RELEASE_BUILD_LINKER_FLAGS : " -s -w"
2325 run : make compile-lambda-linux-all
2426
2527 - uses : actions/upload-artifact@v3
Original file line number Diff line number Diff line change 55# RELEASE_BUILD_LINKER_FLAGS disables DWARF and symbol table generation to reduce binary size
66# RELEASE_BUILD_LINKER_FLAGS=-s -w
77
8-
98BINARY_NAME =aws-lambda-rie
109ARCH =x86_64
1110GO_ARCH_x86_64 := amd64
@@ -25,7 +24,7 @@ compile-with-docker:
2524 docker run --rm --env GOPROXY=direct -v $(shell pwd) :/LambdaRuntimeLocal -w /LambdaRuntimeLocal golang:1.18 make ARCH=${ARCH} compile-lambda-linux
2625
2726compile-lambda-linux :
28- CGO_ENABLED=0 GOOS=linux GOARCH=${GO_ARCH_${ARCH} } go build -ldflags " ${RELEASE_BUILD_LINKER_FLAGS} " -gcflags=" all=-N -l " -o ${DESTINATION_${ARCH} } ./cmd/localstack
27+ CGO_ENABLED=0 GOOS=linux GOARCH=${GO_ARCH_${ARCH} } go build -ldflags " ${RELEASE_BUILD_LINKER_FLAGS} " -gcflags=" ${GC_FLAGS} " -o ${DESTINATION_${ARCH} } ./cmd/localstack
2928
3029tests :
3130 go test ./...
Load Diff This file was deleted.
Load Diff This file was deleted.
Load Diff This file was deleted.
File renamed without changes.
Original file line number Diff line number Diff line change 1+ aws-lambda-rie
2+ build-delve /dlv
3+ init /var /rapid /init
4+ init /var /rapid /dlv
File renamed without changes.
Original file line number Diff line number Diff line change 1+ # Golang EOL overview: https://endoflife.date/go
2+ DOCKER_GOLANG_IMAGE ?= golang:1.18.2
3+
4+ # On ARM hosts, use: make ARCH=arm64 build-init
5+ # Check host architecture: uname -m
6+ # x86_64 or arm64
7+ ARCH ?= x86_64
8+
9+ ifeq ($(ARCH ) , arm64)
10+ GOARCH =arm64
11+ else
12+ GOARCH =amd64
13+ endif
14+
15+ # Limitation: Debugging x86_64 lambdas does not work on ARM machines due to missing ptrace implementation in qemu used by Docker
16+ # The function aborts with "could not launch process: fork/exec /var/rapid/init: function not implemented"
17+ # * Discussion: https://github.com/aws/aws-sam-cli/discussions/4706
18+ # * Docker for Mac: https://github.com/docker/for-mac/issues/5191#issuecomment-834154431
19+
20+
21+ all : build
22+
23+ # build & "package" necessary files for debugging
24+ build build-init : build-rapid build-delve/dlv
25+ cp ../bin/aws-lambda-rie-$(ARCH ) ./init/var/rapid/init
26+ cp ./build-delve/dlv ./init/var/rapid/dlv
27+
28+ build-rapid :
29+ cd .. && GC_FLAGS=" all=-N -l" make ARCH=$(ARCH ) compile-lambda-linux
30+
31+ build-delve/dlv :
32+ docker run --rm -v $$(pwd ) /build-delve/:/app/ $(DOCKER_GOLANG_IMAGE ) \
33+ bash -c " cd /app && export GOARCH=$( GOARCH) && ./build.sh"
34+
35+ clean clean-init : clean-rapid clean-delve
36+
37+ clean-rapid :
38+ rm -rf ../bin/aws-lambda-rie-*
39+ rm -rf ./init/var/rapid/init
40+
41+ clean-delve :
42+ rm -rf ./build-delve/dlv
43+ rm -rf ./init/var/rapid/dlv
44+
45+ .PHONY : build build-rapid clean clean-rapid clean-delve
You can’t perform that action at this time.
0 commit comments