Add Makefile and build, deploy scripts

This commit is contained in:
Sangeeth Sudheer 2025-03-28 00:05:53 +05:30
parent bb673b18b8
commit 63394087fe
Signed by: x
GPG Key ID: F6D06ECE734C57D1
2 changed files with 14 additions and 2 deletions

3
.gitignore vendored
View File

@ -100,4 +100,5 @@ Temporary Items
##
whatsapp.db
auto-response-time-map.json
auto-response-time-map.json
out/

View File

@ -4,4 +4,15 @@ start: install-deps
install-deps:
go install ./...
.PHONY: start install-deps
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