forked from rannes.dev/sw-jobs-go
added bash script to build and zip
This commit is contained in:
parent
186db79995
commit
9222b9915d
31
build.sh
Executable file
31
build.sh
Executable file
@ -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"
|
Loading…
Reference in New Issue
Block a user