From 63394087fe98e6989170e17cd2f87967b1f27731 Mon Sep 17 00:00:00 2001 From: Sangeeth Sudheer Date: Fri, 28 Mar 2025 00:05:53 +0530 Subject: [PATCH] Add Makefile and build, deploy scripts --- .gitignore | 3 ++- Makefile | 13 ++++++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 0764bd3..cbb0dbf 100644 --- a/.gitignore +++ b/.gitignore @@ -100,4 +100,5 @@ Temporary Items ## whatsapp.db -auto-response-time-map.json \ No newline at end of file +auto-response-time-map.json +out/ \ No newline at end of file diff --git a/Makefile b/Makefile index 863ea7a..2927182 100644 --- a/Makefile +++ b/Makefile @@ -4,4 +4,15 @@ start: install-deps install-deps: go install ./... -.PHONY: start install-deps \ No newline at end of file +build: + # CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build -o out/wa-autoresponder.linux-amd64 cmd/main.go + CC=x86_64-linux-musl-gcc CXX=x86_64-linux-musl-g++ GOARCH=amd64 GOOS=linux CGO_ENABLED=1 go build -ldflags "-linkmode external -extldflags -static" -o out/wa-autoresponder.linux-amd64 cmd/main.go + # docker run --rm -v $(PWD):/go/src/app -w /go/src/app -e CGO_ENABLED=1 -e GOOS=linux -e GOARCH=amd64 golang:latest go build -o out/wa-autoresponder.linux-amd64 cmd/main.go + +deploy: build + ssh sangeeth@athena.home "bash -l -c 'mkdir -p ~/.local/data/wa-autoresponder'" + ssh sangeeth@athena.home "bash -l -c 'systemctl --user stop wa-autoresponder || true'" + rsync -avhP out/wa-autoresponder.linux-amd64 athena.home:.local/bin/wa-autoresponder + ssh sangeeth@athena.home "bash -l -c 'systemctl --user start wa-autoresponder'" + +.PHONY: start install-deps build \ No newline at end of file