-
Notifications
You must be signed in to change notification settings - Fork 62
/
Makefile
76 lines (65 loc) · 2.18 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
# Setup name variables for the package/tool
NAME := contained.af
PKG := github.com/genuinetools/$(NAME)
CGO_ENABLED := 0
LISTEN_PORT := 10000
# Set any default go build tags.
BUILDTAGS :=
include basic.mk
.PHONY: prebuild
prebuild:
.PHONY: dind
dind: stop-dind ## Starts a docker-in-docker container for running the tests with.
docker run -d \
--tmpfs /var/lib/docker \
--name $(NAME)-dind \
--privileged \
-p $(LISTEN_PORT):$(LISTEN_PORT) \
-v $(CURDIR)/.certs:/etc/docker/ssl \
$(REGISTRY)/docker:userns \
dockerd -D --storage-driver $(DOCKER_GRAPHDRIVER) \
-H tcp://127.0.0.1:2375 \
--host=unix:///var/run/docker.sock \
--userns-remap default \
--log-driver=none \
--exec-opt=native.cgroupdriver=cgroupfs \
--ip-forward=false \
--ip-masq=false \
--icc=false \
--tlsverify \
--tlscacert=/etc/docker/ssl/cacert.pem \
--tlskey=/etc/docker/ssl/server.key \
--tlscert=/etc/docker/ssl/server.cert
.PHONY: stop-dind
stop-dind: ## Stops the docker-in-docker container.
@docker rm -f $(NAME)-dind >/dev/null 2>&1 || true
.PHONY: run
run: dind image ## Run the server locally in a docker container.
docker run --rm -i $(DOCKER_FLAGS) \
-v $(CURDIR)/.certs:/etc/docker/ssl:ro \
--net container:$(NAME)-dind \
--disable-content-trust=true \
$(REGISTRY)/$(NAME) -d \
--dcacert=/etc/docker/ssl/cacert.pem \
--dcert=/etc/docker/ssl/client.cert \
--dkey=/etc/docker/ssl/client.key \
--port=$(LISTEN_PORT)
DOCKER_FLAGS+=--rm -i \
--disable-content-trust=true
DOCKER_FLAGS+=-v $(CURDIR):/go/src/$(PKG)
DOCKER_FLAGS+=--workdir /go/src/$(PKG)
frontend/js/contained.min.js: image-dev
docker run $(DOCKER_FLAGS) \
$(REGISTRY)/$(NAME):dev \
uglifyjs --output $@ --compress --mangle -- \
frontend/js/xterm.js \
frontend/js/fit.js \
frontend/js/jquery-3.5.1.min.js \
frontend/js/questions.js \
frontend/js/main.js
frontend/css/contained.min.css: image-dev
docker run $(DOCKER_FLAGS) \
$(REGISTRY)/$(NAME):dev \
sh -c 'cat frontend/css/normalize.css frontend/css/bootstrap.min.css frontend/css/xterm.css frontend/css/custom.css | cleancss -o $@'
.PHONY: dev
dev: frontend/js/contained.min.js frontend/css/contained.min.css ## Build the frontend components.