-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathMakefile
48 lines (40 loc) · 1.5 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
VERSION ?= development
TAG := ${VERSION}
TEST_CONTAINERS := 4
TEST_NAMESPACE := testing
run: build
@docker run --rm -ti --privileged --name=btsync cusspvz/btsync:${TAG}
run-bootstrap: build
@echo "Starting container cusspvz/btsync:${TAG}";
@docker run --rm -ti --privileged cusspvz/btsync:${TAG} bootstrap A22QYMGFPY3EVHZY2OWU6HR3ZLXEZBT54 default
run-bash: build
@docker run --rm -ti --privileged --name=btsync cusspvz/btsync:${TAG} bash
build:
@echo "Building image cusspvz/btsync:${TAG}";
@docker build -t cusspvz/btsync:${TAG} .
push: build
@docker push cusspvz/btsync:${TAG}
build-test-suite:
@docker build -t cusspvz/btsync:test-suite test/
test: build build-test-suite
@\
SECRET=$$(docker run --rm -ti --entrypoint=/bin/bash cusspvz/btsync:${TAG} -c "btsync --generate-secret" | tr -cd '[[:alnum:]]._-'); \
echo "Generated a secret for this tests: $$SECRET"; \
LINKS=""; \
for i in `seq 1 ${TEST_CONTAINERS}`; do \
echo "Starting $$i testee container cusspvz/btsync:${TAG}"; \
docker run -d --privileged --name=btsync-$$i cusspvz/btsync:${TAG} bootstrap $$SECRET ${TEST_NAMESPACE}; \
LINKS="$$LINKS -l btsync-$$i:btsync-$$i"; \
done; \
echo "Starting test container"; \
docker run --rm -ti --privileged \
--name "test-suite" \
$$LINKS \
-e NAMESPACE=${TEST_NAMESPACE} \
-e SECRET=$$SECRET \
cusspvz/btsync:test-suite ; \
for i in `seq 1 ${TEST_CONTAINERS}`; do \
echo "Removing $$i testee container"; \
docker kill btsync-$$i > /dev/null; \
docker rm --force btsync-$$i; \
done;