This commit is contained in:
2019-10-25 09:17:14 -07:00
parent e2adbd1629
commit 2991852b72
5 changed files with 117 additions and 26 deletions

View File

@@ -3,28 +3,39 @@ BUILDTIME := $(shell date -u '+%Y-%m-%dT%H:%M:%SZ')
BUILDUSER := $(shell whoami)
BUILDHOST := $(shell hostname -s)
BUILDARCH := $(shell uname -m)
APPNAME := merp
GOLDFLAGS += -X main.Version=$(VERSION)
GOLDFLAGS += -X main.Buildtime=$(BUILDTIME)
GOLDFLAGS += -X main.Builduser=$(BUILDUSER)@$(BUILDHOST)
GOLDFLAGS += -X main.Buildarch=$(BUILDARCH)
GOLDFLAGS += -X main.Appname=$(APPNAME)
GOFLAGS = -ldflags "$(GOLDFLAGS)"
default: run
run: build
DEBUG=1 ./pooteeweet
DEBUG=1 ./$(APPNAME)
build: ./pooteeweet
build: ./$(APPNAME)
./pooteeweet: *.go
./$(APPNAME): *.go
go build -o $@ $(GOFLAGS) .
clean:
rm pooteeweet
rm $(APPNAME)
fmt:
go fmt *.go
test:
docker build -t sneak/pooteeweet .
test: build-image
build-and-push-image: push-image
push-image: build-image
docker push sneak/$(APPNAME)
build-image:
docker build \
-t sneak/$(APPNAME):$(VERSION) \
.