#!/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"