-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
35 lines (29 loc) · 1.26 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
# Plugin parameters
PLUGIN_NAME=simonasr/jsonudpdriver
PLUGIN_BUILD_DIR=/tmp/.plugin-build
PLUGIN_TAG=0.1.0
all: clean build-image create-plugin enable-plugin
clean:
@echo "Removing plugin build directory"
rm -rf ${PLUGIN_BUILD_DIR}
build-image:
@echo "docker build: rootfs image with the plugin"
docker build -f Dockerfile -t ${PLUGIN_NAME}:${PLUGIN_TAG} .
@echo "### create rootfs directory in ${PLUGIN_BUILD_DIR}/rootfs"
mkdir -p ${PLUGIN_BUILD_DIR}/rootfs
docker create --name rootfsctr ${PLUGIN_NAME}:${PLUGIN_TAG}
docker export rootfsctr | tar -x -C ${PLUGIN_BUILD_DIR}/rootfs
@echo "### copy config.json to ${PLUGIN_BUILD_DIR}/"
cp config.json ${PLUGIN_BUILD_DIR}/
docker rm -vf rootfsctr
create-plugin:
@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_BUILD_DIR}"
docker plugin create ${PLUGIN_NAME}:${PLUGIN_TAG} ${PLUGIN_BUILD_DIR}
enable-plugin:
@echo "### enable plugin ${PLUGIN_NAME}:${PLUGIN_TAG}"
docker plugin enable ${PLUGIN_NAME}:${PLUGIN_TAG}
push: clean build-image create-plugin enable-plugin
@echo "### push plugin ${PLUGIN_NAME}:${PLUGIN_TAG}"
docker plugin push ${PLUGIN_NAME}:${PLUGIN_TAG}