-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathMakefile.deps
46 lines (35 loc) · 1.25 KB
/
Makefile.deps
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
BIN ?= image/bin
TARGET_ARCH ?= amd64
DUMB_INIT_VERSION ?= 1.1.3
GOSU_VERSION ?= 1.10
# These are available in apt for yakkety+
CURL_${BIN}/gosu ?= https://github.com/tianon/gosu/releases/download/${GOSU_VERSION}/gosu-${TARGET_ARCH}
CURL_${BIN}/dumb-init ?= https://github.com/Yelp/dumb-init/releases/download/v${DUMB_INIT_VERSION}/dumb-init_${DUMB_INIT_VERSION}_${TARGET_ARCH}
CURL_DEPS = ${BIN}/gosu ${BIN}/dumb-init
DEPS += ${CURL_DEPS}
REPO_${BIN}/dockerize ?= github.com/jwilder/$(notdir $@)
REPO_${BIN}/prefixout ?= github.com/akatrevorjay/$(notdir $@)
REPO_${BIN}/envsubst ?= github.com/a8m/$(notdir $@)/cmd/$(notdir $@)
GOLANG_DEPS = ${BIN}/dockerize ${BIN}/prefixout ${BIN}/envsubst
DEPS += ${GOLANG_DEPS}
##
## golang
##
GOLANG_IMAGE = golang:1.10
GOLANG_BUILD_CMD ?= \
docker create -v /go/bin --name golang-build-out-$(notdir $@) busybox:latest /bin/true \
&& ( \
docker run --rm --volumes-from golang-build-out-$(notdir $@) ${GOLANG_IMAGE} go get -u -v $(REPO_$@) \
&& docker cp golang-build-out-$(notdir $@):/go/bin/$(notdir $@) $(abspath ${BIN}) \
); \
docker rm golang-build-out-$(notdir $@)
${GOLANG_DEPS}:
${GOLANG_BUILD_CMD}
test -e "$@"
##
## curl
##
${CURL_DEPS}:
curl -sSLfo "[email protected]" "$(CURL_$@)"
chmod +x "[email protected]"
mv "[email protected]" "$@"