Last active
February 10, 2020 18:18
-
-
Save yogeshlonkar/b6135f02e43130dabeaeb14c31366350 to your computer and use it in GitHub Desktop.
AWS Golang monorepo lambdas build.sh
This file contains 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
#!/usr/bin/env bash | |
source ./functions.sh | |
# iterate over each package in array, create function and zip it | |
for func in "${function_dirs[@]}" | |
do | |
lambda_func=${func}-function | |
echo "Generating ${lambda_func} artifact" | |
# since each lambda directory contains exactly same main.go | |
# below command will generate new function feach lambda | |
GOARCH=amd64 GOOS=linux go build -o ${lambda_func} ./${func}/main.go | |
zip ${lambda_func} ${lambda_func} | |
rm ${lambda_func} # remove binary | |
done |
This file contains 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
#!/usr/bin/env bash | |
BASE_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" | |
# adds all lambda package/directory | |
function_dirs=($(ls -1 ${BASE_DIR} | grep "\-lambda")) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment