#!/usr/bin/env bash

set -e

APP_NAME="gpio-monitor-server"
CMD_PATH="./cmd/server"
BUILD_DIR="./build"

echo ">> Cleaning old build..."
rm -rf ${BUILD_DIR}
mkdir -p ${BUILD_DIR}

echo ">> Downloading dependencies..."
go mod tidy

echo ">> Building ${APP_NAME}..."

GOOS=linux GOARCH=arm64 go build -o ${BUILD_DIR}/${APP_NAME} ${CMD_PATH}

echo ">> Build complete:"
ls -lh ${BUILD_DIR}/${APP_NAME}
