-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
49 lines (37 loc) · 846 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
CONTAINER_NAME = mongodb
MONGODB_VERSION = 6.0.6
MONGODB_PORT = 27017
COMMIT_HASH := $(shell git rev-parse --short HEAD)
LDFLAGS := -X 'main.commit=${COMMIT_HASH}'
init:
asdf install
mkdir -p ./mongo_data/data ./mongo_data/log
up:
docker run -d \
--name $(CONTAINER_NAME) \
-p $(MONGODB_PORT):$(MONGODB_PORT) \
-v "$(shell pwd)/mongo_data/data/:/data/mongodb" \
-v "$(shell pwd)/mongo_data/log:/var/log" \
mongo:$(MONGODB_VERSION) \
mongod \
--dbpath /data/mongodb \
--logpath /var/log/mongodb.log \
--logappend \
--vv
down:
docker stop $(CONTAINER_NAME)
docker rm $(CONTAINER_NAME)
logs:
docker logs $(CONTAINER_NAME)
exec:
docker exec -it $(CONTAINER_NAME) mongosh
fmt:
go fmt ./...
tidy:
go mod tidy
update:
go get -u ./...
install:
go install -ldflags "$(LDFLAGS)"
test: up
go test -v -cover ./...