-
Notifications
You must be signed in to change notification settings - Fork 31
/
makefile
56 lines (41 loc) · 1019 Bytes
/
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
VERSION := $(shell git describe --tags --dirty --always)
SERVICE := cj
OWNER := southclaws
LDFLAGS := -ldflags "-X main.version=$(VERSION)"
-include .env
# -
# Local Development
#-
static:
CGO_ENABLED=0 GOOS=linux go build -a $(LDFLAGS) -o $(SERVICE) .
fast:
go build $(LDFLAGS) -o $(SERVICE)
local: fast
./$(SERVICE)
test:
CGO_ENABLED=1 go test -v -race ./storage
CGO_ENABLED=1 go test -v -race ./bot/commands
version:
git tag $(VERSION)
git push
git push origin $(VERSION)
# -
# Docker
# -
build:
docker build --no-cache -t $(OWNER)/$(SERVICE):$(VERSION) .
push:
docker push $(OWNER)/$(SERVICE):$(VERSION)
docker tag $(OWNER)/$(SERVICE):$(VERSION) $(OWNER)/$(SERVICE):latest
docker push $(OWNER)/$(SERVICE):latest
# -
# Testing Database
# -
mongodb-stop:
-docker stop mongodb
-docker rm mongodb
-docker stop express
-docker rm express
mongodb: mongodb-stop
docker run --name mongodb -p 27017:27017 -d mongo
docker run --name express --link mongodb:mongo -p 8080:8081 -d mongo-express