-
Notifications
You must be signed in to change notification settings - Fork 9
/
Makefile
57 lines (46 loc) · 1.78 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
.PHONY: build
SHELL := /bin/bash
export TESTS
header = " \e[1;34m%-30s\e[m \n"
row = "\e[1mmake %-32s\e[m %-50s \n"
VERSION := $(shell cat VERSION)
all:
@printf $(header) "Build"
@printf $(row) "build" "Build production binary."
@printf $(row) "docker" "Build a nanny container image using Docker."
@printf $(row) "buildah" "Build a nanny container image using Buildah."
@printf $(row) "push" "Push the latest and current version tagged container images to Docker Hub and Quay.io."
@printf $(row) "package" "Build and create .tar.gz."
@printf $(row) "clean" "Clean from build artefacts."
@printf $(header) "Dev"
@printf $(row) "run" "Run Nanny in dev mode, all logging and race detector ON."
@printf $(row) "test" "Run tests."
@printf $(row) "vet" "Run go vet."
@printf $(row) "lint" "Run gometalinter (you have to install it)."
build:
go get github.com/ahmetb/govvv
govvv build -pkg nanny/pkg/version
docker:
docker build --no-cache -t lunemec/nanny:$(VERSION) .
docker tag nanny:$(VERSION) lunemec/nanny:latest
buildah:
buildah bud --no-cache -t docker.io/library/lunemec/nanny:$(VERSION) .
buildah tag docker.io/library/lunemec/nanny:$(VERSION) docker.io/library/lunemec/nanny:latest
push:
buildah push docker.io/library/lunemec/nanny:$(VERSION) docker://quay.io/nanny/nanny:$(VERSION)
buildah push docker.io/library/lunemec/nanny:latest docker://quay.io/nanny/nanny:latest
buildah push docker.io/library/lunemec/nanny:$(VERSION) docker://docker.io/lunemec/nanny:$(VERSION)
buildah push docker.io/library/lunemec/nanny:latest docker://docker.io/lunemec/nanny:latest
package: clean build
scripts/package.sh
run:
LOGXI=* go run -race main.go
test:
go test -race -cover -v ./...
vet:
go vet ./...
lint:
golangci-lint run --timeout=60s
clean:
rm nanny || true
rm *.tar.gz || true