-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
59 lines (53 loc) · 1.57 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
CWD=/go/src/github.com/imega-teleport/db2file
build: test
@mkdir -p $(CURDIR)/test
@docker run --rm \
-v $(CURDIR)/sql:/sql \
--link server_db:s \
imega/mysql-client \
mysql --host=s --database=test_teleport -e "source /sql/dump.sql"
@docker run --rm \
-v $(CURDIR):$(CWD) \
-w $(CWD) \
-e GOOS=linux \
-e GOARCH=amd64 \
-e CGO_ENABLED=0 \
-e DB_USER=root \
-e DB_PASS=1 \
-e DB_HOST="server_db:3306" \
--link server_db:server_db \
golang:1.8-alpine \
sh -c 'go build -v -o db2file && ./db2file -db test_teleport -path $(CWD)/test'
db:
@touch $(CURDIR)/mysql.log
@docker run -d \
--name "server_db" \
-v $(CURDIR)/sql/cnf:/etc/mysql/conf.d \
-v $(CURDIR)/mysql.log:/var/log/mysql/mysql.log \
imega/mysql
@docker run --rm \
-v $(CURDIR)/sql:/sql \
--link server_db:s \
imega/mysql-client \
mysql --host=s -e "source /sql/schema.sql"
@docker run --rm \
-v $(CURDIR)/sql:/sql \
--link server_db:s \
imega/mysql-client \
mysql --host=s --database=test_teleport -e "source /sql/dump.sql"
@docker run --rm \
-v $(CURDIR)/sql:/sql \
--link server_db:s \
imega/mysql-client \
mysql --host=s --database=wp_teleport -e "source /sql/teleport_schema.sql"
clean:
@-docker stop server_db
@-docker rm -fv server_db
test: clean db
@docker run --rm -v $(CURDIR):$(CWD) -w $(CWD) \
golang:1.8-alpine sh -c "go list ./... | grep -v 'vendor\|integration' | xargs go test"
dep:
@docker run --rm \
-v $(CURDIR):$(CWD) \
-w $(CWD) \
golang:1.8-alpine sh -c 'apk add --update git && go get -u github.com/golang/dep/cmd/dep && dep ensure -v'