make output/build artifact
This commit is contained in:
23
Makefile
23
Makefile
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user