2019-08-22 14:34:10 +00:00
|
|
|
PLUGIN_NAME = devplayer0/net-dhcp
|
|
|
|
PLUGIN_TAG ?= latest
|
|
|
|
|
2019-08-23 11:55:35 +00:00
|
|
|
all: clean rootfs build create
|
2019-08-22 14:34:10 +00:00
|
|
|
|
|
|
|
clean:
|
|
|
|
@echo "### rm ./plugin"
|
|
|
|
@rm -rf ./plugin
|
|
|
|
|
2019-08-23 11:55:35 +00:00
|
|
|
build:
|
2019-08-22 14:34:10 +00:00
|
|
|
@echo "### docker build: rootfs image with net-dhcp"
|
|
|
|
@docker build -t ${PLUGIN_NAME}:rootfs .
|
2019-08-23 11:55:35 +00:00
|
|
|
|
|
|
|
rootfs:
|
2019-08-22 14:34:10 +00:00
|
|
|
@echo "### create rootfs directory in ./plugin/rootfs"
|
|
|
|
@mkdir -p ./plugin/rootfs
|
|
|
|
@docker create --name tmp ${PLUGIN_NAME}:rootfs
|
|
|
|
@docker export tmp | tar -x -C ./plugin/rootfs
|
|
|
|
@echo "### copy config.json to ./plugin/"
|
|
|
|
@cp config.json ./plugin/
|
|
|
|
@docker rm -vf tmp
|
|
|
|
|
|
|
|
create:
|
|
|
|
@echo "### remove existing plugin ${PLUGIN_NAME}:${PLUGIN_TAG} if exists"
|
|
|
|
@docker plugin rm -f ${PLUGIN_NAME}:${PLUGIN_TAG} || true
|
|
|
|
@echo "### create new plugin ${PLUGIN_NAME}:${PLUGIN_TAG} from ./plugin"
|
|
|
|
@docker plugin create ${PLUGIN_NAME}:${PLUGIN_TAG} ./plugin
|
|
|
|
|
2019-08-23 11:55:35 +00:00
|
|
|
debug:
|
|
|
|
@docker run --rm -ti --cap-add CAP_SYS_ADMIN --network host --volume /run/docker/plugins:/run/docker/plugins \
|
2019-08-25 11:48:03 +00:00
|
|
|
--volume /run/docker.sock:/run/docker.sock --volume /var/run/docker/netns:/var/run/docker/netns \
|
|
|
|
${PLUGIN_NAME}:rootfs
|
2019-08-23 11:55:35 +00:00
|
|
|
|
2019-08-23 13:26:58 +00:00
|
|
|
enable:
|
2019-08-22 14:34:10 +00:00
|
|
|
@echo "### enable plugin ${PLUGIN_NAME}:${PLUGIN_TAG}"
|
|
|
|
@docker plugin enable ${PLUGIN_NAME}:${PLUGIN_TAG}
|
|
|
|
|
2019-08-23 13:26:58 +00:00
|
|
|
push: clean rootfs create enable
|
2019-08-22 14:34:10 +00:00
|
|
|
@echo "### push plugin ${PLUGIN_NAME}:${PLUGIN_TAG}"
|
|
|
|
@docker plugin push ${PLUGIN_NAME}:${PLUGIN_TAG}
|