-
Notifications
You must be signed in to change notification settings - Fork 5
/
Makefile
53 lines (39 loc) · 1.7 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
VERSION=$(shell cat VERSION)
docker-build:
docker build --build-arg VERSION=$(VERSION) -t leeif/pluto:latest .
docker tag leeif/pluto:latest leeif/pluto:$(VERSION)
docker-build-staging:
docker build --build-arg VERSION=staging -t leeif/pluto:staging .
docker-push:
docker push leeif/pluto:latest
docker push leeif/pluto:$(VERSION)
docker-push-staging:
docker push leeif/pluto:staging
docker-clean:
docker rmi leeif/pluto:latest || true
docker rmi leeif/pluto:$(VERSION) || true
docker rm -v $(shell docker ps --filter status=exited -q 2>/dev/null) 2>/dev/null || true
docker rmi $(shell docker images --filter dangling=true -q 2>/dev/null) 2>/dev/null || true
docker-clean-staging:
docker rmi leeif/pluto:staging || true
docker rm -v $(shell docker ps --filter status=exited -q 2>/dev/null) 2>/dev/null || true
docker rmi $(shell docker images --filter dangling=true -q 2>/dev/null) 2>/dev/null || true
check-version-tag:
git pull --tags
if git --no-pager tag --list | grep $(VERSION) -q ; then echo "$(VERSION) already exsits"; exit 1; fi
update-tag:
git pull --tags
if git --no-pager tag --list | grep $(VERSION) -q ; then echo "$(VERSION) already exsits"; exit 1; fi
git tag $(VERSION)
git push origin $(VERSION)
server-binary-build:
mkdir -p bin
GO111MODULE=on go build -ldflags="-X 'main.VERSION=$(VERSION)'" -o bin/pluto-server cmd/pluto-server/main.go
migrate-binary-build:
mkdir -p bin
GO111MODULE=on go build -o bin/pluto-migrate cmd/pluto-migrate/main.go
unit-test:
GO111MODULE=on go test -v ./...
test: unit-test
ci-build-production: test check-version-tag docker-build docker-push docker-clean update-tag
ci-build-staging: test docker-build-staging docker-push-staging docker-clean-staging