From 9222b9915dec622a98c734121895784021e74547 Mon Sep 17 00:00:00 2001 From: christian Date: Sat, 8 Jun 2024 19:50:48 +0200 Subject: [PATCH] added bash script to build and zip --- build.sh | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100755 build.sh diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..d00175b --- /dev/null +++ b/build.sh @@ -0,0 +1,31 @@ +#!/bin/bash + +# Set variables +PACKAGE_DIR="./lambda-package" +BUILD_FILE="bootstrap" +ZIP_FILE="lambda-deployment.zip" +SOURCE_FILE="main.go" + +# Delete the content of the lambda-package directory +rm -rf $PACKAGE_DIR/* +echo "Deleted the content of $PACKAGE_DIR" + +# Set environment variables and build the Go project +GOOS=linux GOARCH=arm64 go build -o $BUILD_FILE -tags lambda.norpc $SOURCE_FILE +echo "Built the Go project with GOOS=linux and GOARCH=arm64" + +# Move the build file to the lambda-package directory +mv $BUILD_FILE $PACKAGE_DIR/ +echo "Moved the build file to $PACKAGE_DIR" + +# Change directory to lambda-package +cd $PACKAGE_DIR + +# Zip the contents of lambda-package into lambda-deployment.zip +zip -r $ZIP_FILE * +echo "Zipped the contents of $PACKAGE_DIR into $ZIP_FILE" + +# Return to the original directory +cd - + +echo "Script completed successfully"