forked from gravitational/teleport
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
80 lines (71 loc) · 2.07 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
79
80
#
# This Makefile is used for producing official Teleport releases
#
BBOX=teleport-buildbox:latest
HOSTNAME=buildbox
SRCDIR=/gopath/src/github.com/gravitational/teleport
DOCKERFLAGS=--rm=true -v "$$(pwd)/../":$(SRCDIR) -w $(SRCDIR) -h $(HOSTNAME)
ADDFLAGS=-ldflags -w
NOROOT=-u $$(id -u):$$(id -g)
#
# Build 'teleport' release inside a docker container
#
.PHONY:build
build: bbox
docker run $(DOCKERFLAGS) $(NOROOT) $(BBOX) \
make -C $(SRCDIR) ADDFLAGS='$(ADDFLAGS)' release
#
# Build 'teleport' release inside a docker container
#
.PHONY:build-binaries
build-binaries: bbox
docker run $(DOCKERFLAGS) $(NOROOT) $(BBOX) \
make -C $(SRCDIR) ADDFLAGS='$(ADDFLAGS)' all
#
# Builds a Docker container which is used for building official Teleport
# binaries and docs
#
.PHONY:bbox
bbox:
docker build --build-arg UID=$$(id -u) --build-arg GID=$$(id -g) --tag $(BBOX) .
#
# Runs tests inside a build container
#
.PHONY:test
test: integration
docker run $(DOCKERFLAGS) $(NOROOT) -t $(BBOX) \
/bin/bash -c \
"examples/etcd/start-etcd.sh & sleep 1; \
ssh-agent > external.agent && source external.agent; \
cd $(SRCDIR) && make TELEPORT_DEBUG=0 FLAGS='-cover -race' clean test"
.PHONY:integration
integration: bbox
docker run $(DOCKERFLAGS) $(NOROOT) -t $(BBOX) \
/bin/bash -c "make -C $(SRCDIR) FLAGS='-cover' integration"
#
# Builds docs
#
.PHONY:docs
docs: bbox
docker run $(DOCKERFLAGS) -ti $(NOROOT) -e HOME=$(SRCDIR)/build.assets $(BBOX) \
./docs/build.sh
@echo "\nSUCCESS: Teleport docs ----> build/docs\n"
#
# Runs docs website on localhost
#
.PHONY:run-docs
run-docs: bbox
@echo -e "\n\n----> LIVE EDIT HERE: http://localhost:6600/admin-guide/\n"
docker run $(DOCKERFLAGS) -ti $(NOROOT) -e HOME=$(SRCDIR)/build.assets -p 6600:6600 -w $(SRCDIR) $(BBOX) mkdocs serve -a 0.0.0.0:6600
#
# Starts shell inside the build container
#
.PHONY:enter
enter: bbox
docker run $(DOCKERFLAGS) -ti $(NOROOT) $(BBOX) /bin/bash
#
# Create a teleport package using the build container
#
.PHONY:release
release:
docker run $(DOCKERFLAGS) -i $(NOROOT) $(BBOX) /usr/bin/make release -e ADDFLAGS="$(ADDFLAGS)"