make output/build artifact

This commit is contained in:
2019-10-24 08:23:29 -07:00
parent 8a029686d8
commit cf51968fb9
4 changed files with 25 additions and 10 deletions

View File

@@ -1,9 +1,13 @@
VERSION := $(shell git rev-parse --short HEAD)
BUILDTIME := $(shell date -u '+%Y-%m-%dT%H:%M:%SZ')
BUILDTIMEFILENAME := $(shell date -u '+%Y%m%d-%H%M%SZ')
BUILDUSER := $(shell whoami)
BUILDHOST := $(shell hostname -s)
BUILDARCH := $(shell uname -m)
FN := fediverse-archive
IMAGENAME := sneak/$(FN)
GOLDFLAGS += -X main.Version=$(VERSION)
GOLDFLAGS += -X main.Buildtime=$(BUILDTIME)
GOLDFLAGS += -X main.Builduser=$(BUILDUSER)@$(BUILDHOST)
@@ -13,18 +17,25 @@ GOFLAGS = -ldflags "$(GOLDFLAGS)"
default: rundebug
rundebug: build
./fediverse-archive -debug
./$(FN) -debug
run: build
./fediverse-archvie
./$(FN)
build: ./fediverse-archive
build: ./$(FN)
./fediverse-archive: *.go
./$(FN): *.go
go build -o $@ $(GOFLAGS) .
fmt:
go fmt *.go
test:
docker build -t sneak/fediverse-archive .
test: build-docker-image
build-docker-image:
docker build -t $(IMAGENAME) .
dist: build-docker-image
-mkdir -p ./output
docker run --rm --entrypoint cat $(IMAGENAME) /bin/$(FN) > output/$(FN)
docker save $(IMAGENAME) | bzip2 > output/$(BUILDTIMEFILENAME).$(FN).tbz2