forked from AVENTER-UG/traefik-mesos
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
74 lines (59 loc) · 2.1 KB
/
Makefile
File metadata and controls
74 lines (59 loc) · 2.1 KB
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
#Dockerfile vars
#vars
IMAGENAME=traefik_mesos
TAG=v2.11.1
BRANCH=`git rev-parse --abbrev-ref HEAD`
IMAGEFULLNAME=avhost/${IMAGENAME}
BUILDDATE=`date -u +%Y-%m-%d`
VERSION_TU=$(subst -, ,$(TAG:v%=%))
BUILD_VERSION=$(word 1,$(VERSION_TU))
LASTCOMMIT=$(shell git log -1 --pretty=short | tail -n 1 | tr -d " " | tr -d "UPDATE:")
.PHONY: help build build-docker clean all
help:
@echo "Makefile arguments:"
@echo ""
@echo "Makefile commands:"
@echo "build"
@echo "build-docker"
@echo "all"
@echo ${TAG}
.DEFAULT_GOAL := all
ifeq (${BRANCH}, master)
BRANCH=latest
endif
ifneq ($(shell echo $(LASTCOMMIT) | grep -E '^v|([0-9]+\.){0,2}(\*|[0-9]+)'),)
BRANCH=${LASTCOMMIT}
else
BRANCH=latest
endif
clone:
@if [ ! -d "traefik_repo" ] ; then \
git clone https://github.com/traefik/traefik.git traefik_repo; \
fi
cd traefik_repo; git checkout $(TAG)
patch:
patch -u traefik_repo/pkg/config/static/static_config.go -i static_config.patch
patch -u traefik_repo/pkg/provider/aggregator/aggregator.go -i aggregator.patch
cp -pr mesos traefik_repo/pkg/provider/
build:
@echo ">>>> Build traefik executable ${BUILD_VERSION}"
cp -pr mesos traefik_repo/pkg/provider/
@cd traefik_repo; go get -d
@cd traefik_repo; go get github.com/mesos/mesos-go/api/v0/detector/zoo
@cd traefik_repo; go mod tidy
cd traefik_repo; $(MAKE) generate-webui
cp static/mesos.svg traefik_repo/webui/static/providers/
export VERSION=${BUILD_VERSION}; cd traefik_repo; $(MAKE)
build-docker: build
@echo ">>>> Build docker image" ${BRANCH}
docker build -t ${IMAGEFULLNAME}:latest .
push:
@echo ">>>> Publish it to repo" ${BRANCH}
docker buildx create --use --name buildkit
docker buildx build --platform linux/amd64 --push --build-arg VERSION=${TAG} -t ${IMAGEFULLNAME}:${BRANCH} .
docker buildx build --platform linux/amd64 --push --build-arg VERSION=${TAG} -t ${IMAGEFULLNAME}:${BRANCH}-${BUILDDATE} .
docker buildx build --platform linux/amd64 --push --build-arg VERSION=${TAG} -t ${IMAGEFULLNAME}:latest .
docker buildx rm buildkit
clean:
rm -rf traefik_repo
all: clone patch build-docker clean