forked from infobloxopen/docker-infoblox
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
60 lines (51 loc) · 1.76 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
ifeq ($(DOCKERHUB_ID),)
PLUGIN_NAME=docker-ipam-plugin
TOOLS_IMAGE_NAME=docker-ipam-tools
else
PLUGIN_NAME=${DOCKERHUB_ID}/docker-ipam-plugin
TOOLS_IMAGE_NAME=${DOCKERHUB_ID}/docker-ipam-tools
endif
RELEASE=1.1.0
.PHONY: clean-plugin
clean-plugin:
rm -rf ./plugin ./bin
docker plugin disable ${PLUGIN_NAME}:${RELEASE} || true
docker plugin rm ${PLUGIN_NAME}:${RELEASE} || true
docker rm -vf tmp || true
docker rmi ipam-build-image || true
docker rmi ${PLUGIN_NAME}:rootfs || true
.PHONY: build-binary
build-binary:
docker build -t ipam-build-image -f Dockerfile.build .
docker create --name build-container ipam-build-image
docker cp build-container:/go/src/github.com/infobloxopen/docker-infoblox/bin .
docker rm -vf build-container
docker rmi ipam-build-image
.PHONY: build-plugin
build-plugin: build-binary
docker build -t ${PLUGIN_NAME}:rootfs .
mkdir -p ./plugin/rootfs
docker create --name tmp ${PLUGIN_NAME}:rootfs
docker export tmp | tar -x -C ./plugin/rootfs
cp config.json ./plugin/
docker rm -vf tmp
.PHONY: create-plugin
create-plugin: clean-plugin build-plugin
docker plugin create ${PLUGIN_NAME}:${RELEASE} ./plugin
.PHONY: enable-plugin
enable-plugin: create-plugin
docker plugin enable ${PLUGIN_NAME}:${RELEASE}
.PHONY: push-plugin
push-plugin: create-plugin
docker plugin push ${PLUGIN_NAME}:${RELEASE}
.PHONY: clean-tools-image
clean-tools-image:
docker rmi ${TOOLS_IMAGE_NAME}:${RELEASE} || true
docker rmi ${TOOLS_IMAGE_NAME} || true
.PHONY: build-tools-image
build-tools-image: clean-tools-image build-binary
docker build -t ${TOOLS_IMAGE_NAME} -f Dockerfile.tools .
.PHONY: push-tools-image
push-tools-image: build-tools-image
docker tag ${TOOLS_IMAGE_NAME} ${TOOLS_IMAGE_NAME}:${RELEASE}
docker push ${TOOLS_IMAGE_NAME}:${RELEASE}