Makefile 1.3 KB

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