Skip to content

Commit

Permalink
chore: update make script
Browse files Browse the repository at this point in the history
  • Loading branch information
gitsang committed Jun 22, 2022
1 parent 207f968 commit 24ff82b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
/bin
/target
/build
/ddns
*.tar.gz

# Test binary, built with `go test -c`
*.test
Expand Down
16 changes: 14 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,23 @@ help: ## show help

LD_FLAGS=-ldflags "-X ddns/pkg/config.Version=$(VERSION)"

build: ## build target
clean: ## clean build target

rm -fr $(TARGET_PATH)
rm -f *.tar.gz

build: clean ## build target

mkdir -p $(TARGET_PATH) $(TARGET_PATH)/bin $(TARGET_PATH)/conf $(TARGET_PATH)/log
go build $(LD_FLAGS) -o $(TARGET_PATH)/bin/$(SERVICE_NAME) cmd/$(SERVICE_NAME).go
cp configs/template.yml $(TARGET_PATH)/conf
cp configs/ddns.service $(TARGET_PATH)/conf

tag: build ## make tgz package

cp -r $(TARGET_PATH) $(SERVICE_NAME)
tar zcvf $(SERVICE_NAME).$(VERSION).tar.gz $(SERVICE_NAME)
rm -fr $(SERVICE_NAME)

docker: build ## build docker

Expand All @@ -38,7 +50,7 @@ pull: ## pull latest published docker

docker pull $(DOCKER_REPO)/$(SERVICE_NAME):latest

install: build ## install by systemd
install: ## install by systemd

cp $(TARGET_PATH)/bin/$(SERVICE_NAME) /usr/local/bin/
cp configs/ddns.service /etc/systemd/system/
Expand Down

0 comments on commit 24ff82b

Please sign in to comment.