Skip to content
This repository has been archived by the owner on Jun 3, 2023. It is now read-only.

Commit

Permalink
Switch to Amazon Linux 2 Lambda runtime
Browse files Browse the repository at this point in the history
  • Loading branch information
mlafeldt committed Aug 20, 2021
1 parent 4a15b28 commit c21a1e7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
12 changes: 10 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,21 @@ lint:
test:
go test -v -cover ./...

# https://github.com/messense/homebrew-macos-cross-toolchains
TARGET := x86_64-unknown-linux-gnu
export CC_x86_64_unknown_linux_gnu = $(TARGET)-gcc
export CXX_x86_64_unknown_linux_gnu = $(TARGET)-g++
export AR_x86_64_unknown_linux_gnu = $(TARGET)-ar
export CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_LINKER = $(TARGET)-gcc
export RUSTFLAGS = -C link-arg=-s

RUST_FUNCS := $(subst /,,$(dir $(wildcard */lambda.rs)))

rust_funcs := $(RUST_FUNCS:%=rust-%)

rust: $(rust_funcs)

$(rust_funcs):
RUSTFLAGS="-C link-arg=-s" cargo build --release --target x86_64-unknown-linux-musl --bin $(@:rust-%=%)
cargo build --release --target $(TARGET) --bin $(@:rust-%=%)
mkdir -p bin/$(@:rust-%=%)
cp -f target/x86_64-unknown-linux-musl/release/$(@:rust-%=%) bin/$(@:rust-%=%)/bootstrap
cp -f target/$(TARGET)/release/$(@:rust-%=%) bin/$(@:rust-%=%)/bootstrap
2 changes: 1 addition & 1 deletion index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export class DilbertFeedStack extends cdk.Stack {
functionName: `${id}-heartbeat`,
code: lambda.Code.fromAsset('bin/heartbeat'),
handler: 'bootstrap',
runtime: lambda.Runtime.PROVIDED,
runtime: lambda.Runtime.PROVIDED_AL2,
memorySize: 128,
timeout: cdk.Duration.seconds(10),
logRetention: logs.RetentionDays.ONE_MONTH,
Expand Down

0 comments on commit c21a1e7

Please sign in to comment.