From 112e7e07048b1ae7010e4e8f704c90aeafd08551 Mon Sep 17 00:00:00 2001 From: DataHearth Date: Mon, 17 May 2021 19:11:01 +0200 Subject: [PATCH] update ignoredocker and makefile --- .dockerignore | 7 ++++--- Makefile | 44 ++++++++++++++------------------------------ 2 files changed, 18 insertions(+), 33 deletions(-) diff --git a/.dockerignore b/.dockerignore index 1278d87..c747ede 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,6 +1,7 @@ +bin +.gitignore ddnsclient.yaml ddnsclient.yaml.sample -bin -Makefile +LICENSE README.md -.gitignore \ No newline at end of file +Makefile \ No newline at end of file diff --git a/Makefile b/Makefile index f74fa9d..7cf919a 100644 --- a/Makefile +++ b/Makefile @@ -1,33 +1,17 @@ -GO := $(shell command -v go 2> /dev/null) -DOCKER := $(shell command -v docker 2> /dev/null) -RELEASE_VERSION ?= $(shell bash -c 'read -s -p "Release version: " pwd') +BINARY_FOLDER = bin/ddnsclient -.PHONY: build build: -ifndef GO - @echo "go is required!" -endif - @echo "building ddnsclient..." - @go build -o bin/ddnsclient cmd/main.go - @echo "module built!" - -.PHONY: deploy-image-latest -deploy-image-latest: -ifndef DOCKER - @echo "docker is required!" -endif - @echo "building image..." - @docker build --tag=datahearth/ddnsclient:latest . - @echo "Pushing image ddnsclient:latest to docker hub..." - @docker push datahearth/ddnsclient:latest - @echo "Image pushed!" - -.PHONY: deploy-image-release -deploy-image-release: -ifndef DOCKER - @echo "docker is required!" -endif - @echo "Pushing image with tag to docker hub..." - @docker push ddnsclient:$(RELEASE_VERSION) - @echo "Image pushed!" + @command -v go >/dev/null || (echo 'go CLI is required to build ddnsclient'; exit 1) + @echo "Create ddnsclient binary" + go build -o $(BINARY_FOLDER) cmd/main.go + @echo "Binary created in $(BINARY_FOLDER)" +create-docker-image: + @command -v docker >/dev/null || (echo 'docker is required to create docker image'; exit 1) + @read -p "Docker release: " release; \ + docker build --tag datahearth/ddnsclient:$$release . + +push-docker-image: + @command -v docker >/dev/null || (echo 'docker is required to create docker image'; exit 1) + @read -p "Docker image tag: " tag; \ + docker push datahearth/ddnsclient:$$tag . \ No newline at end of file