Skip to content

Instantly share code, notes, and snippets.

@rday
Last active May 27, 2016 18:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rday/aaecc79657bf69bbfa2a15da532508a1 to your computer and use it in GitHub Desktop.
Save rday/aaecc79657bf69bbfa2a15da532508a1 to your computer and use it in GitHub Desktop.
Example makefile
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