-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
56 lines (39 loc) · 1.29 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
.PHONY: build run rundocker
GOIMAGE=golang:1.18-stretch
CASSANDRAIMAGE=cassandra:4.0
POSTGRESIMAGE=postgres:13.3
build:
go build cmd/app.go
run:
go run cmd/app.go
test:
go test -v -count=1 -race -cover ./...
getgolangci:
cd tools && go install github.com/golangci/golangci-lint/cmd/golangci-lint
lint: getgolangci
golangci-lint run --config .golangci.yml
imports:
goimports -l -w .
builddocker:
docker run --rm -v ${PWD}:/app -w /app ${GOIMAGE} make build
lintdocker:
docker run --rm -v ${PWD}:/app -w /app ${GOIMAGE} make lint
rundocker: runcassandra
docker run --rm -v ${PWD}:/app -w /app -p 8080:5000 ${GOIMAGE} make run
runcassandra:
docker run --rm -d -p 9042:9042 ${CASSANDRAIMAGE}
runpostgres:
docker run --rm -d -p 5432:5432 -e POSTGRES_PASSWORD=pass -v ${PWD}/docker/postgres/initdb:/docker-entrypoint-initdb.d ${POSTGRESIMAGE}
buildeb:
GOARCH=amd64 GOOS=linux go build -o build/bin/application cmd/app.go
# on docker case
apt update && apt install -y zip
cd build && zip -r ../app.zip *
buildforerasticbeans:
docker run --rm -v ${PWD}:/app -w /app ${GOIMAGE} make buildeb
compose:
docker compose -f ./docker/docker-compose.yaml up -d
compose_m1:
docker compose -f ./docker/docker-compose.yaml -f ./docker/m1mac.yaml up -d
stop:
docker compose -f ./docker/docker-compose.yaml stop