feat: Add build scripts, refactor for binary embedding

This commit is contained in:
Florian Sylvain
2023-08-12 19:42:27 +02:00
parent 047e14df60
commit 7e8b415cab
12 changed files with 98 additions and 17 deletions
+30
View File
@@ -0,0 +1,30 @@
#!/bin/sh
export GOARCH=amd64
OUTPUT_DIR=./bin
GO_FILE_PATH="./main/main.go"
PROGRAM_NAME=GohCMS
# Compile for Windows
GOOS=windows go build -o "$OUTPUT_DIR/${PROGRAM_NAME}_windows.exe" "$GO_FILE_PATH"
if [ $? -ne 0 ]; then
echo "Compilation for Windows failed."
exit $?
fi
# Compile for Linux
GOOS=linux go build -o "$OUTPUT_DIR/${PROGRAM_NAME}_linux" "$GO_FILE_PATH"
if [ $? -ne 0 ]; then
echo "Compilation for Linux failed."
exit $?
fi
# Compile for macOS
GOOS=darwin go build -o "$OUTPUT_DIR/${PROGRAM_NAME}_darwin" "$GO_FILE_PATH"
if [ $? -ne 0 ]; then
echo "Compilation for macOS failed."
exit $?
fi
echo "Compilation successful for all platforms."