summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile54
1 files changed, 42 insertions, 12 deletions
diff --git a/Makefile b/Makefile
index 3e599d0..6038948 100644
--- a/Makefile
+++ b/Makefile
@@ -1,22 +1,52 @@
1IMAGE="docker.crute.me/websocket-proxy" 1IMAGE=docker.crute.me/ssh-proxy
2VERSION="0.1.0" 2BINARY=ssh-proxy
3 3
4websocket-proxy: main.go sockets.go server.go client.go localclient.go 4$(BINARY): $(shell find . -name '*.go')
5 CGO_ENABLED=0 go build -ldflags "-X main.version=$(VERSION)" -o $@ $^ 5 @[ "$(CLIENT_ID)" ] || ( echo "CLIENT_ID must be set"; exit 1 )
6
7 CGO_ENABLED=0 go build \
8 -ldflags "-X main.appVersion=$(shell git describe --long --tags --dirty --always) \
9 -X code.crute.us/mcrute/ssh-proxy/cmd/client.clientId=$(CLIENT_ID)" \
10 -o $@
11
12.PHONY: vet
13vet: main.go
14 go vet $<
6 15
7.PHONY: docker 16.PHONY: docker
8docker: websocket-proxy 17docker: $(BINARY)
9 mkdir docker; \ 18 mkdir docker; cp Dockerfile web-server docker; cd docker; \
10 cp Dockerfile websocket-proxy docker; \ 19 docker pull $(shell grep '^FROM ' Dockerfile | cut -d' ' -f2); \
11 cd docker; \ 20 docker build --no-cache -t $(IMAGE):stage .
12 docker build -t $(IMAGE):$(VERSION) .
13 21
14.PHONY: publish 22.PHONY: publish
15publish: 23publish:
16 docker push $(IMAGE):$(VERSION) 24 docker push $(IMAGE):stage
17 docker tag $(IMAGE):$(VERSION) $(IMAGE):latest 25
26.PHONY: publish-prod
27publish-prod:
28 docker tag $(IMAGE):stage $(IMAGE):latest
18 docker push $(IMAGE):latest 29 docker push $(IMAGE):latest
19 30
20.PHONY: clean 31.PHONY: clean
21clean: 32clean:
22 rm -rf websocket-proxy docker 33 rm -rf docker || true
34 rm $(BINARY) || true
35
36.PHONY: run-backfill
37run-backfill: clean $(BINARY)
38 test -n "$(VAULT_ROLE_ID)" # Caller must export VAULT_ROLE_ID
39 test -n "$(VAULT_SECRET_ID)" # Caller must also export VAULT_SECRET_ID
40 VAULT_ADDR="https://vault.sea4.crute.me:8200" \
41 VAULT_SKIP_VERIFY=true \
42 ./web-server backfill-shakes
43
44.PHONY: run-web
45run-web: clean $(BINARY)
46 test -n "$(VAULT_ROLE_ID)" # Caller must export VAULT_ROLE_ID
47 test -n "$(VAULT_SECRET_ID)" # Caller must also export VAULT_SECRET_ID
48 VAULT_ADDR="https://vault.sea4.crute.me:8200" \
49 VAULT_SKIP_VERIFY=true \
50 ./$(BINARY) --debug \
51 --hostname=dev.ssh-proxy.crute.me \
52 web