-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
60 lines (51 loc) · 2.03 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
PLUGIN_NAME=docker-plugin-volume-test
PLUGIN_VERSION=1.0.0
PLUGIN_PLATFORM=linux/amd64
all: clean rootfs create
.PHONY: clean
clean:
@echo "### rm ./plugin"
@rm -rf ./plugin
.PHONY: rootfs
rootfs:
@echo "### docker build: rootfs ${PLUGIN_PLATFORM} image with docker-volume-rbd"
@docker build --platform ${PLUGIN_PLATFORM} -t ${PLUGIN_NAME}:rootfs .
@echo "### create rootfs directory in ./plugin/rootfs"
@mkdir -p ./plugin/rootfs
@docker create --name tmp ${PLUGIN_NAME}:rootfs
@docker export tmp | tar -x --exclude=dev/ -C ./plugin/rootfs
@echo "### copy config.json to ./plugin/"
@cp config.json ./plugin/
@docker rm -vf tmp
.PHONY: create
create:
@echo "### remove existing plugin ${PLUGIN_NAME}:${PLUGIN_VERSION} if exists"
@docker plugin rm -f ${PLUGIN_NAME}:${PLUGIN_VERSION} || true
@echo "### remove existing plugin ${PLUGIN_NAME}:latest if exists"
@docker plugin rm -f ${PLUGIN_NAME}:latest || true
@echo "### create new plugin ${PLUGIN_NAME}:${PLUGIN_VERSION} from ./plugin"
@docker plugin create ${PLUGIN_NAME}:${PLUGIN_VERSION} ./plugin
@echo "### create new plugin ${PLUGIN_NAME}:latest from ./plugin"
@docker plugin create ${PLUGIN_NAME}:latest ./plugin
.PHONY: push
push:
@echo "### push plugin ${PLUGIN_NAME}:${PLUGIN_VERSION}"
@docker plugin push ${PLUGIN_NAME}:${PLUGIN_VERSION}
@echo "### push plugin ${PLUGIN_NAME}:latest"
@docker plugin push ${PLUGIN_NAME}:latest
.PHONY: enable
enable:
@echo "### enable plugin ${PLUGIN_NAME}:${PLUGIN_VERSION}"
@docker plugin enable ${PLUGIN_NAME}:${PLUGIN_VERSION}
.PHONY: upgrade
upgrade:
@echo "### disable plugin ${PLUGIN_NAME}"
@docker plugin disable -f ${PLUGIN_NAME}
@echo "### upgrade plugin ${PLUGIN_NAME} to ${PLUGIN_NAME}:${PLUGIN_VERSION}"
@docker plugin upgrade ${PLUGIN_NAME} ${PLUGIN_NAME}:${PLUGIN_VERSION}
@echo "### enable plugin ${PLUGIN_NAME}"
@docker plugin enable ${PLUGIN_NAME}
.PHONY: dev
dev:
@echo "### docker build: dev ${PLUGIN_PLATFORM} image with golang deps"
@docker build --platform ${PLUGIN_PLATFORM} -q -t ${PLUGIN_NAME}:dev --target go-builder .