-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
78 lines (64 loc) · 2.27 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
COMPOSER_FLAGS = --ignore-platform-reqs --no-interaction --no-dev -o
TELEPORT_FILEMAN ?= imegateleport/tokio
TELEPORT_PARSER ?= imegateleport/oslo
build: build/composer build-fs
@docker build -t imegateleport/oslo .
push:
@docker push imegateleport/oslo:latest
build_dir:
@-mkdir -p $(CURDIR)/build
build-fs: build_dir
@docker run --rm \
-v $(CURDIR)/runner:/runner \
-v $(CURDIR)/build:/build \
-v $(CURDIR)/src:/src \
-v $(CURDIR)/vendor:/src/vendor \
-v $(CURDIR)/config:/src/config \
imega/base-builder:1.1.1 \
--packages="php php-json rsync inotify-tools"
get_containers:
$(eval CONTAINERS := $(subst build/containers/,,$(shell find build/containers -type f)))
stop: get_containers
@-docker stop $(CONTAINERS)
clean: stop
@-docker rm -fv $(CONTAINERS)
@rm -rf build/containers/*
build/composer:
@mkdir -p $(shell dirname $@)
@docker run --rm -v $(CURDIR):/data imega/composer update $(COMPOSER_FLAGS)
@touch $@
build/containers/teleport_fileman:
@mkdir -p $(shell dirname $@)
@docker run -d \
--name teleport_fileman \
--restart=always \
-v $(CURDIR)/data:/data \
$(TELEPORT_FILEMAN)
@touch $@
build/containers/teleport_tester:
@cd tests;docker build -t imegateleport/oslo_tester .
build/containers/teleport_parser:
@mkdir -p $(shell dirname $@)
@docker run -d --name teleport_parser --restart=always \
--link teleport_fileman:fileman \
$(TELEPORT_PARSER)
@touch $@
discovery_parser:
@while [ "`docker inspect -f {{.State.Running}} teleport_parser`" != "true" ]; do \
echo "wait teleport_parser"; sleep 0.3; \
done
$(eval IP := $(shell docker inspect --format '{{ .NetworkSettings.IPAddress }}' teleport_parser))
docker exec teleport_fileman sh -c 'echo -e "$(IP)\tparser" >> /etc/hosts'
data_dir:
@-mkdir -p $(CURDIR)/data/zip $(CURDIR)/data/parse $(CURDIR)/data/storage
@-chmod -R 777 $(CURDIR)/data
test: data_dir build/containers/teleport_fileman build/containers/teleport_parser discovery_parser build/containers/teleport_tester
@docker run --rm \
--link teleport_parser:parser \
-v $(CURDIR)/tests/fixtures:/data \
imegateleport/oslo_tester \
rsync --inplace -av /data/9915e49a-4de1-41aa-9d7d-c9a687ec048d rsync://parser/data
@sleep 1
@if [ `ls data/storage/9915e49a-4de1-41aa-9d7d-c9a687ec048d/ | wc -l` != 6 ];then \
exit 1; \
fi