blob: 6baad7f85f8b4a99984aab52b2f5f1b0c36a8cb2 (
plain)
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
|
IMAGE=docker.crute.me/ssh-proxy
BINARY=ssh-proxy
CLIENT_BINARY=ssh-proxy-client
$(BINARY): $(CLIENT_BINARY) $(shell find . -name '*.go' -o -name '*.tpl' -o -name '*.js')
@[ "$(CLIENT_ID)" ] || ( echo "CLIENT_ID must be set"; exit 1 )
CGO_ENABLED=0 go build \
-ldflags "-X main.appVersion=$(shell git describe --long --tags --dirty --always) \
-X code.crute.us/mcrute/ssh-proxy/cmd/client.clientId=$(CLIENT_ID)" \
-o $@
$(CLIENT_BINARY): $(shell find . -name '*.go')
@[ "$(CLIENT_ID)" ] || ( echo "CLIENT_ID must be set"; exit 1 )
CGO_ENABLED=0 go build \
-tags clientonly \
-ldflags "-X main.appVersion=$(shell git describe --long --tags --dirty --always) \
-X code.crute.us/mcrute/ssh-proxy/cmd/client.clientId=$(CLIENT_ID) \
-s -w" \
-o $@
.PHONY: vet
vet: main.go
go vet $<
.PHONY: docker
docker: $(BINARY)
mkdir docker; cp Dockerfile $(BINARY) docker; cd docker; \
docker pull $(shell grep '^FROM ' Dockerfile | cut -d' ' -f2); \
docker build --no-cache -t $(IMAGE):stage .
.PHONY: publish
publish:
docker push $(IMAGE):stage
.PHONY: publish-prod
publish-prod:
docker tag $(IMAGE):stage $(IMAGE):latest
docker push $(IMAGE):latest
.PHONY: clean
clean:
rm -rf docker || true
rm $(BINARY) || true
.PHONY: run-backfill
run-backfill: clean $(BINARY)
test -n "$(VAULT_ROLE_ID)" # Caller must export VAULT_ROLE_ID
test -n "$(VAULT_SECRET_ID)" # Caller must also export VAULT_SECRET_ID
VAULT_ADDR="https://vault.sea4.crute.me:8200" \
VAULT_SKIP_VERIFY=true \
./web-server backfill-shakes
.PHONY: run-web
run-web: clean $(BINARY)
test -n "$(VAULT_ROLE_ID)" # Caller must export VAULT_ROLE_ID
test -n "$(VAULT_SECRET_ID)" # Caller must also export VAULT_SECRET_ID
VAULT_ADDR="https://vault.sea4.crute.me:8200" \
VAULT_SKIP_VERIFY=true \
./$(BINARY) \
--hostname=dev.ssh-proxy.crute.me \
web
|