Browse Source

build(plugins): add build label imnage plugins

zhanghongtong 4 years ago
parent
commit
c1714bf652
3 changed files with 21 additions and 10 deletions
  1. 4 0
      .ci/Dockerfile-plugins
  2. 1 9
      .github/workflows/build_packages.yaml
  3. 16 1
      Makefile

+ 4 - 0
.ci/Dockerfile-plugins

@@ -30,6 +30,10 @@ RUN set -e -u -x \
            && cd TDengine-client-2.0.6.0 && ./install_client.sh && cd - \
            && cd TDengine-client-2.0.6.0 && ./install_client.sh && cd - \
            && go build -trimpath --buildmode=plugin -tags plugins -o plugins/$PLUGIN_TYPE/$PLUGIN_NAME/$PLUGIN_NAME@$VERSION.so plugins/$PLUGIN_TYPE/$PLUGIN_NAME/$PLUGIN_NAME.go \
            && go build -trimpath --buildmode=plugin -tags plugins -o plugins/$PLUGIN_TYPE/$PLUGIN_NAME/$PLUGIN_NAME@$VERSION.so plugins/$PLUGIN_TYPE/$PLUGIN_NAME/$PLUGIN_NAME.go \
            ;; \
            ;; \
+         labelImage ) \
+           git clone -b v2.2.0-rc3 --depth 1 https://github.com/tensorflow/tensorflow.git /tensorflow; \
+           CGO_CFLAGS=-I/tensorflow CGO_LDFLAGS=-L/go/kuiper/plugins/functions/labelImage/lib go build -trimpath --buildmode=plugin -o plugins/functions/labelImage/labelImage.so plugins/functions/labelImage/*.go \
+           ;; \
          * ) \
          * ) \
            go build -trimpath --buildmode=plugin -o plugins/$PLUGIN_TYPE/$PLUGIN_NAME/$PLUGIN_NAME@$VERSION.so plugins/$PLUGIN_TYPE/$PLUGIN_NAME/*.go \
            go build -trimpath --buildmode=plugin -o plugins/$PLUGIN_TYPE/$PLUGIN_NAME/$PLUGIN_NAME@$VERSION.so plugins/$PLUGIN_TYPE/$PLUGIN_NAME/*.go \
            ;; \
            ;; \

+ 1 - 9
.github/workflows/build_packages.yaml

@@ -70,18 +70,10 @@ jobs:
                 - functions/echo
                 - functions/echo
                 - functions/image
                 - functions/image
                 - functions/geohash
                 - functions/geohash
+                - functions/labelImage
 
 
         steps:
         steps:
         - uses: actions/checkout@v1
         - uses: actions/checkout@v1
-        - name: install docker
-          run: |
-            sudo apt-get remove docker docker-engine docker.io containerd runc
-            sudo apt-get update
-            sudo apt-get install apt-transport-https ca-certificates curl gnupg-agent software-properties-common
-            curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
-            sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
-            sudo apt-get update
-            sudo apt-get install docker-ce docker-ce-cli containerd.io
         - name: prepare docker
         - name: prepare docker
           run: |
           run: |
             mkdir -p $HOME/.docker
             mkdir -p $HOME/.docker

+ 16 - 1
Makefile

@@ -182,7 +182,7 @@ PLUGINS := sinks/file \
 	functions/echo
 	functions/echo
 
 
 .PHONY: plugins sinks/tdengine $(PLUGINS)
 .PHONY: plugins sinks/tdengine $(PLUGINS)
-plugins: cross_prepare sinks/tdengine $(PLUGINS)
+plugins: cross_prepare sinks/tdengine functions/labelImage $(PLUGINS)
 sinks/tdengine:
 sinks/tdengine:
 	@docker buildx build --no-cache \
 	@docker buildx build --no-cache \
     --platform=linux/amd64,linux/arm64 \
     --platform=linux/amd64,linux/arm64 \
@@ -200,6 +200,21 @@ sinks/tdengine:
 	done
 	done
 	@rm -f /tmp/cross_build_plugins_sinks_tdengine.tar
 	@rm -f /tmp/cross_build_plugins_sinks_tdengine.tar
 
 
+functions/labelImage:
+	@docker buildx build --no-cache \
+    --platform=linux/amd64 \
+    -t cross_build \
+    --build-arg VERSION=$(VERSION) \
+    --build-arg PLUGIN_TYPE=functions \
+    --build-arg PLUGIN_NAME=labelImage \
+    --output type=tar,dest=/tmp/cross_build_plugins_functions_labelImage.tar \
+    -f .ci/Dockerfile-plugins .
+
+	@mkdir -p _plugins/debian/functions
+	@tar -xvf /tmp/cross_build_plugins_functions_labelImage.tar --wildcards "go/kuiper/plugins/functions/labelImage/labelImage_amd64.zip"
+	@mv $$(ls go/kuiper/plugins/functions/labelImage/labelImage_amd64.zip) _plugins/debian/functions
+	@rm -f /tmp/cross_build_plugins_functions_labelImage.tar
+
 $(PLUGINS): PLUGIN_TYPE = $(word 1, $(subst /, , $@))
 $(PLUGINS): PLUGIN_TYPE = $(word 1, $(subst /, , $@))
 $(PLUGINS): PLUGIN_NAME = $(word 2, $(subst /, , $@))
 $(PLUGINS): PLUGIN_NAME = $(word 2, $(subst /, , $@))
 $(PLUGINS):
 $(PLUGINS):