Last active
May 27, 2016 18:43
-
-
Save rday/aaecc79657bf69bbfa2a15da532508a1 to your computer and use it in GitHub Desktop.
Example makefile
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
APP_SRC=${GOPATH} | |
APP_BIN=bin | |
BINARY=test-service | |
VERSION=0.2.1 | |
.PHONY: all | |
all: dev | |
.PHONY: clean | |
clean: | |
rm -f ${APP_BIN}/${BINARY} | |
$(APP_BIN)/$(BINARY): | |
CGO_ENABLED=0 \ | |
GOOS=linux \ | |
GOARCH=amd64 \ | |
go build -ldflags "-X main.version=$(VERSION)" -v -o $(BINARY) | |
.PHONY: install | |
install: $(APP_BIN)/$(BINARY) | |
docker build -t reponame/$(BINARY):$(VERSION) . | |
.PHONY: dev | |
dev: $(APP_BIN)/$(BINARY) | |
docker build -t 172.16.45.2:5000/$(BINARY):$(VERSION)-test . | |
docker push 172.16.45.2:5000/$(BINARY):$(VERSION)-test |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment