123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- # Copyright 2021 EMQ Technologies Co., Ltd.
- #
- # Licensed under the Apache License, Version 2.0 (the "License");
- # you may not use this file except in compliance with the License.
- # You may obtain a copy of the License at
- #
- # http://www.apache.org/licenses/LICENSE-2.0
- #
- # Unless required by applicable law or agreed to in writing, software
- # distributed under the License is distributed on an "AS IS" BASIS,
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- # See the License for the specific language governing permissions and
- # limitations under the License.
- FROM golang:1.15.1 AS builder
- ARG VERSION
- ARG PLUGIN_TYPE
- ARG PLUGIN_NAME
- COPY . /go/kuiper
- WORKDIR /go/kuiper
- RUN set -e -u -x \
- && apt-get update \
- && apt-get install -y pkg-config libczmq-dev jq zip --assume-yes apt-utils
- RUN set -e -u -x \
- && mkdir -p _plugins/$PLUGIN_TYPE/$PLUGIN_NAME \
- && for lib in $(cat etc/$PLUGIN_TYPE/$PLUGIN_NAME.json | jq -r ".libs[]"); do go get $lib; done \
- && case $PLUGIN_NAME in \
- influxdb ) \
- go build -trimpath -modfile extensions.mod --buildmode=plugin -tags plugins -o plugins/$PLUGIN_TYPE/$PLUGIN_NAME/$PLUGIN_NAME@$VERSION.so extensions/$PLUGIN_TYPE/$PLUGIN_NAME/$PLUGIN_NAME.go \
- ;; \
- tdengine ) \
- if [ "$(uname -m)" = "x86_64" ]; then \
- wget "https://www.taosdata.com/download/download-all.php?pkgType=tdengine_linux&pkgName=TDengine-client-2.0.19.1-Linux-x64.tar.gz" -O /tmp/TDengine-client-2.0.19.1.tar.gz; \
- fi; \
- if [ "$(uname -m)" = "aarch64" ]; then \
- wget "https://www.taosdata.com/download/download-all.php?pkgType=tdengine_linux&pkgName=TDengine-client-2.0.19.1-Linux-aarch64.tar.gz" -O /tmp/TDengine-client-2.0.19.1.tar.gz; \
- fi; \
- tar -zxvf /tmp/TDengine-client-2.0.19.1.tar.gz \
- && cd TDengine-client-2.0.19.1 && ./install_client.sh && cd - \
- && go build -trimpath -modfile extensions.mod --buildmode=plugin -tags plugins -o plugins/$PLUGIN_TYPE/$PLUGIN_NAME/$PLUGIN_NAME@$VERSION.so extensions/$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/extensions/functions/labelImage/lib go build -trimpath -modfile extensions.mod --buildmode=plugin -o plugins/functions/labelImage/labelImage.so extensions/functions/labelImage/*.go \
- ;; \
- * ) \
- go build -trimpath -modfile extensions.mod --buildmode=plugin -o plugins/$PLUGIN_TYPE/$PLUGIN_NAME/$PLUGIN_NAME@$VERSION.so extensions/$PLUGIN_TYPE/$PLUGIN_NAME/*.go \
- ;; \
- esac \
- && if [ -f "etc/$PLUGIN_TYPE/$PLUGIN_NAME.yaml" ]; then cp etc/$PLUGIN_TYPE/$PLUGIN_NAME.yaml plugins/$PLUGIN_TYPE/$PLUGIN_NAME; fi \
- && cd plugins/$PLUGIN_TYPE/$PLUGIN_NAME \
- && zip -r ${PLUGIN_NAME}_$(go version | grep -o "linux/.*" | sed -r 's linux/(.*) \1 g').zip .
|