-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile
48 lines (40 loc) · 1.11 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
ifeq ($(VERBOSE), 1)
DOCKER_BUILD_FLAGS :=
CURL_FLAGS :=
VERBOSE_OUTPUT := >&1
else
CURL_FLAGS := -s
DOCKER_BUILD_FLAGS := -q
VERBOSE_OUTPUT := >/dev/null
MAKEFLAGS += -s
endif
VERSION ?= $(shell git describe --tags --always --dirty)
REGISTRY ?= gcr.io/kuar-demo
IMAGE_NAME := $(REGISTRY)/ngrok
BUILDSTAMP_NAME := $(subst /,_,$(IMAGE_NAME))
IMAGE_BUILDSTAMP := .$(BUILDSTAMP_NAME)-container
PUSH_BUILDSTAMP := .$(BUILDSTAMP_NAME)-push
VERSION ?= $(shell git describe --tags --always --dirty)
NGROK_URL := https://bin.equinox.io/c/4VmDzA7iaHb/ngrok-stable-linux-amd64.zip
.PHONY: build
build: $(IMAGE_BUILDSTAMP)
$(IMAGE_BUILDSTAMP): out/ngrok Dockerfile
docker build \
$(DOCKER_BUILD_FLAGS) \
-t $(IMAGE_NAME):$(VERSION) .
echo "$(IMAGE_NAME):$(VERSION)" > $@
out/ngrok:
mkdir -p $(@D) && \
cd $(@D) && \
curl $(CURL_FLAGS) -L -o ngrok.zip $(NGROK_URL) && \
unzip ngrok.zip
.PHONY: push
push: $(PUSH_BUILDSTAMP)
$(PUSH_BUILDSTAMP): $(IMAGE_BUILDSTAMP)
@echo "pushing :" $$(sed -n '1p' $<)
gcloud docker -- push $$(sed -n '1p' $<)
cat $< > $@
.PHONY: clean
clean:
rm -f .*-container .*-push
rm -rf out