Makefile 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. PLUGIN_NAME = registry.dierkse.nl/net-dhcp
  2. PLUGIN_TAG ?= latest
  3. all: clean build rootfs create enable
  4. clean:
  5. @echo "### rm ./plugin"
  6. @rm -rf ./plugin
  7. build:
  8. @echo "### docker build: rootfs image with net-dhcp"
  9. @docker build -t ${PLUGIN_NAME}:rootfs .
  10. rootfs:
  11. @echo "### create rootfs directory in ./plugin/rootfs"
  12. @mkdir -p ./plugin/rootfs
  13. @docker create --name tmp ${PLUGIN_NAME}:rootfs
  14. @docker export tmp | tar -x -C ./plugin/rootfs
  15. @echo "### copy config.json to ./plugin/"
  16. @cp config.json ./plugin/
  17. @docker rm -vf tmp
  18. create:
  19. @echo "### remove existing plugin ${PLUGIN_NAME}:${PLUGIN_TAG} if exists"
  20. @docker plugin rm -f ${PLUGIN_NAME}:${PLUGIN_TAG} || true
  21. @echo "### create new plugin ${PLUGIN_NAME}:${PLUGIN_TAG} from ./plugin"
  22. @docker plugin create ${PLUGIN_NAME}:${PLUGIN_TAG} ./plugin
  23. debug:
  24. @docker run --rm -ti --cap-add CAP_SYS_ADMIN --network host --volume /run/docker/plugins:/run/docker/plugins \
  25. --volume /run/docker.sock:/run/docker.sock --volume /var/run/docker/netns:/var/run/docker/netns \
  26. ${PLUGIN_NAME}:rootfs
  27. enable:
  28. @echo "### enable plugin ${PLUGIN_NAME}:${PLUGIN_TAG}"
  29. @docker plugin enable ${PLUGIN_NAME}:${PLUGIN_TAG}
  30. push:
  31. @echo "### push plugin ${PLUGIN_NAME}:${PLUGIN_TAG}"
  32. @docker plugin push ${PLUGIN_NAME}:${PLUGIN_TAG}