This repository has been archived by the owner on Jan 21, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
51 lines (42 loc) · 1.63 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
# Plugin parameters
PLUGIN_NAME=lfdominguez/docker-log-driver-loki
PLUGIN_TAG=latest
all: clean docker rootfs create
all-hub: clean rootfs-hub create enable
clean:
@echo "### rm ./plugin"
rm -rf ./plugin
docker:
@echo "### docker build: rootfs image with ${PLUGIN_NAME}"
docker build -t ${PLUGIN_NAME}:rootfs .
rootfs:
@echo "### create rootfs directory in ./plugin/rootfs"
mkdir -p ./plugin/rootfs
docker create --name tmprootfs ${PLUGIN_NAME}:rootfs
docker export tmprootfs | tar -x -C ./plugin/rootfs
@echo "### copy config.json to ./plugin/"
cp config.json ./plugin/
docker rm -vf tmprootfs
rootfs-hub:
@echo "### Download image from Hub"
docker pull ${PLUGIN_NAME}:${PLUGIN_TAG}
@echo "### create rootfs directory in ./plugin/rootfs"
mkdir -p ./plugin/rootfs
docker create --name tmprootfs ${PLUGIN_NAME}:${PLUGIN_TAG}
docker export tmprootfs | tar -x -C ./plugin/rootfs
@echo "### copy config.json to ./plugin/"
cp config.json ./plugin/
docker rm -vf tmprootfs
create:
@echo "### disable existing plugin ${PLUGIN_NAME}:${PLUGIN_TAG} if exists"
docker plugin disable -f ${PLUGIN_NAME}:${PLUGIN_TAG} || true
@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
enable:
@echo "### enable plugin ${PLUGIN_NAME}:${PLUGIN_TAG}"
docker plugin enable ${PLUGIN_NAME}:${PLUGIN_TAG}
push: clean docker rootfs create enable
@echo "### push plugin ${PLUGIN_NAME}:${PLUGIN_TAG}"
docker plugin push ${PLUGIN_NAME}:${PLUGIN_TAG}