This repository has been archived by the owner on Jun 25, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 10
/
Makefile
69 lines (51 loc) · 1.89 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
58
59
60
61
62
63
64
65
66
67
68
69
export GO111MODULE=on
SHELL := bash
NAME := navikt/naisd
LATEST := ${NAME}:latest
LDFLAGS := -X github.com/nais/naisd/api/version.Revision=$(shell git rev-parse --short HEAD) -X github.com/nais/naisd/api/version.Version=$(shell /bin/cat ./version)
.PHONY: dockerhub-release install test linux bump tag cli cli-dist build docker-build push-dockerhub docker-minikube-build helm-upgrade
all: install test linux
dockerhub-release: install test linux bump tag docker-build push-dockerhub
bump:
/bin/bash bump.sh
tag:
git tag -a $(shell /bin/cat ./version) -m "auto-tag from Makefile [skip ci]" && git push --tags
install:
go get
test:
go test ./... --coverprofile=cover.out
linux-cli:
CGO_ENABLED=0 \
GOOS=linux \
go build -a -installsuffix cgo -o nais cli/nais.go
cli:
go build -ldflags='$(LDFLAGS)' -o nais ./cli
cli-dist:
GOOS=linux \
GOARCH=amd64 \
go build -o nais-linux-amd64 -ldflags="-s -w $(LDFLAGS)" ./cli/nais.go
sudo xz nais-linux-amd64
GOOS=darwin \
GOARCH=amd64 \
go build -o nais-darwin-amd64 -ldflags="-s -w $(LDFLAGS)" ./cli/nais.go
sudo xz nais-darwin-amd64
GOOS=windows \
GOARCH=amd64 \
go build -o nais-windows-amd64 -ldflags="-s -w $(LDFLAGS)" ./cli/nais.go
zip -r nais-windows-amd64.zip nais-windows-amd64
sudo rm nais-windows-amd64
build:
go build -o naisd
linux:
GOOS=linux \
CGO_ENABLED=0 \
go build -a -installsuffix cgo -ldflags '-s $(LDFLAGS)' -o naisd
docker-build:
docker image build -t ${NAME}:$(shell /bin/cat ./version) -t naisd -t ${NAME} -t ${LATEST} -f Dockerfile .
docker image build -t navikt/nais:$(shell /bin/cat ./version) -t navikt/nais:latest -f Dockerfile.cli .
push-dockerhub:
docker image push ${NAME}:$(shell /bin/cat ./version)
docker image push navikt/nais:$(shell /bin/cat ./version)
docker image push navikt/nais:latest
helm-upgrade:
helm delete naisd; helm upgrade -i naisd helm/naisd --set image.version=$(shell /bin/cat ./version)