-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile
69 lines (56 loc) · 2.09 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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#Dockerfile vars
#vars
IMAGENAME=traefik_mesos
TAG=v3.2.3
BRANCH=$(shell git symbolic-ref --short HEAD | xargs basename)
BRANCHSHORT=$(shell echo ${BRANCH} | awk -F. '{ print $$1"."$$2 }')
IMAGEFULLNAME=avhost/${IMAGENAME}
BUILDDATE=$(shell 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
BRANCHSHORT=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: build
@echo ">>>> Publish it to repo" ${BRANCH}_${BUILDDATE}
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}:${BRANCHSHORT} .
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