-
Notifications
You must be signed in to change notification settings - Fork 13
/
plugin_build.sh
executable file
·37 lines (30 loc) · 1.01 KB
/
plugin_build.sh
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
#!/bin/bash
VERSION="1.0.6"
build_plugin () {
ACTION=$1
ARCH=$2
if [[ "$ARCH" == "" ]]; then
ARCH="amd64"
VERSION_ARCH="$VERSION"
else
VERSION_ARCH="$VERSION-$ARCH"
fi
imagename="rootfsimage-${VERSION_ARCH}"
docker build -t ${imagename} --build-arg=GOARCH=${ARCH} .
id=$(docker create ${imagename} true)
rm -rf rootfs
mkdir -p sumoplugin/rootfs
docker export "$id" | tar -x -C sumoplugin/rootfs
docker rm -vf "$id"
cp config.json ./sumoplugin/
docker plugin create public.ecr.aws/sumologic/docker-logging-driver:${VERSION_ARCH} ./sumoplugin/
if [[ "$ACTION" == "install" ]]; then
docker plugin enable public.ecr.aws/sumologic/docker-logging-driver:${VERSION_ARCH}
elif [[ "$ACTION" == "push" ]]; then
docker plugin push public.ecr.aws/sumologic/docker-logging-driver:${VERSION_ARCH}
else
echo "Invalid action ${ACTION}, must be 'install' or 'push'."
fi
docker rmi ${imagename}
rm -rf sumoplugin
}