This is an automated email from the ASF dual-hosted git repository. yongzao pushed a commit to branch ain-docker in repository https://gitbox.apache.org/repos/asf/iotdb.git
commit 6f263553012d780d2b3255626f4cbb56af588bf4 Author: Yongzao <532741...@qq.com> AuthorDate: Tue Jul 15 19:44:10 2025 +0800 stash --- docker/src/main/DockerCompose/do-docker-build.sh | 10 ++- docker/src/main/DockerCompose/entrypoint.sh | 33 +++++----- docker/src/main/Dockerfile-1.0.0-ainode | 79 ++++++++++++++++++++++++ 3 files changed, 104 insertions(+), 18 deletions(-) diff --git a/docker/src/main/DockerCompose/do-docker-build.sh b/docker/src/main/DockerCompose/do-docker-build.sh index 19037f3834c..b270ee42e97 100755 --- a/docker/src/main/DockerCompose/do-docker-build.sh +++ b/docker/src/main/DockerCompose/do-docker-build.sh @@ -23,7 +23,7 @@ current_path=$(cd $(dirname $0); pwd) iotdb_path=$(cd ${current_path}/../../../../; pwd) iotdb_zip_path=${current_path}/../target/ -options="confignode datanode standalone latest" +options="confignode datanode ainode standalone latest" nocache="true" do_build="false" docker_build="docker build " @@ -110,6 +110,7 @@ function prepare_buildx(){ else docker_build="docker build" ; docker_publish="" ; + # for Linux find ${current_path}/../ -name 'Dockerfile-1.0.0*' | xargs sed -i 's#FROM --platform=$TARGETPLATFORM eclipse-temurin:17-jre-focal#FROM eclipse-temurin:17-jre-focal#g' fi } @@ -119,10 +120,10 @@ function build_iotdb(){ fi echo "##### build IoTDB #####" cd $iotdb_path - mvn clean package -pl distribution -am -DskipTests + mvn clean package -pl distribution -P with-ainode -am -DskipTests if [[ ! -d ${iotdb_zip_path} ]]; then mkdir ${iotdb_zip_path}; fi cd ${iotdb_path}/distribution/target - cp apache-iotdb-${version}-all-bin.zip apache-iotdb-${version}-confignode-bin.zip apache-iotdb-${version}-datanode-bin.zip ${iotdb_zip_path}/ + cp apache-iotdb-${version}-all-bin.zip apache-iotdb-${version}-confignode-bin.zip apache-iotdb-${version}-datanode-bin.zip apache-iotdb-${version}-ainode-bin.zip ${iotdb_zip_path}/ do_build=false echo "##### done #####" } @@ -151,6 +152,9 @@ function main() { datanode) process_single ;; + ainode) + process_single all + ;; standalone) process_single all ;; diff --git a/docker/src/main/DockerCompose/entrypoint.sh b/docker/src/main/DockerCompose/entrypoint.sh index 68df9db78b7..ef90df9d7d4 100755 --- a/docker/src/main/DockerCompose/entrypoint.sh +++ b/docker/src/main/DockerCompose/entrypoint.sh @@ -36,19 +36,22 @@ trap 'on_stop' SIGTERM SIGKILL SIGQUIT replace-conf-from-env.sh case "$1" in - datanode) - exec start-datanode.sh - ;; - confignode) - exec start-confignode.sh - ;; - all) - start-confignode.sh > /dev/null 2>&1 & - sleep 5 - exec start-datanode.sh - ;; - *) - echo "bad parameter!" - exit -1 - ;; + datanode) + exec start-datanode.sh + ;; + confignode) + exec start-confignode.sh + ;; + ainode) + exec start-ainode.sh + ;; + all) + start-confignode.sh > /dev/null 2>&1 & + sleep 5 + exec start-datanode.sh + ;; + *) + echo "bad parameter!" + exit -1 + ;; esac diff --git a/docker/src/main/Dockerfile-1.0.0-ainode b/docker/src/main/Dockerfile-1.0.0-ainode new file mode 100644 index 00000000000..ab870cb7616 --- /dev/null +++ b/docker/src/main/Dockerfile-1.0.0-ainode @@ -0,0 +1,79 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you 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 ubuntu:22.04 +ARG version=2.0.5-SNAPSHOT +ARG target=apache-iotdb-${version}-ainode-bin + +# replace source when necessary +RUN sed -i 's/archive.ubuntu.com/mirrors.ustc.edu.cn/g' /etc/apt/sources.list && \ + sed -i 's/security.ubuntu.com/mirrors.ustc.edu.cn/g' /etc/apt/sources.list +# 更新包索引并安装必要的依赖 +RUN apt-get update && \ + apt-get install -y software-properties-common && \ + add-apt-repository -y ppa:deadsnakes/ppa && \ + apt-get update +# 安装Python 3.12和pip +RUN apt-get install -y python3.12 python3.12-dev python3.12-distutils && \ + apt-get install -y curl && \ + curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py && \ + python3.12 get-pip.py && \ + rm get-pip.py + +RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.12 1 + +RUN apt update \ + && apt install lsof dos2unix procps unzip dumb-init wget inetutils-ping gcc -y \ + && apt autoremove -y \ + && apt purge --auto-remove -y \ + && apt clean -y + +COPY target/${target}.zip / +RUN cd / && unzip ${target}.zip \ + && rm ${target}.zip \ +# && mv ${target} iotdb + && mv apache-iotdb-${version}-ainode-bin ainode + +ENV IOTDB_AINODE_HOME=/ainode VERSION=${version} +WORKDIR ${IOTDB_AINODE_HOME}/sbin + +COPY DockerCompose/replace-conf-from-env.sh . +COPY DockerCompose/entrypoint.sh . + +RUN chmod +x *.sh && dos2unix *.sh \ + && dos2unix ${IOTDB_AINODE_HOME}/conf/*.sh + +RUN mkdir -p ${IOTDB_AINODE_HOME}/data/ainode/models/weights/sundial && \ + mkdir -p ${IOTDB_AINODE_HOME}/data/ainode/models/weights/timer_xl +RUN wget -O ${IOTDB_AINODE_HOME}/data/ainode/models/weights/sundial/config.json https://huggingface.co/thuml/sundial-base-128m/resolve/main/config.json && \ + wget -O ${IOTDB_AINODE_HOME}/data/ainode/models/weights/sundial/model.safetensors https://huggingface.co/thuml/sundial-base-128m/resolve/main/model.safetensors +RUN wget -O ${IOTDB_AINODE_HOME}/data/ainode/models/weights/timer_xl/config.json https://huggingface.co/thuml/timer-base-84m/resolve/main/config.json && \ + wget -O ${IOTDB_AINODE_HOME}/data/ainode/models/weights/timer_xl/model.safetensors https://huggingface.co/thuml/timer-base-84m/resolve/main/model.safetensors + +EXPOSE 10810 +VOLUME $IOTDB_AINODE_HOME/data +VOLUME $IOTDB_AINODE_HOME/logs + +ENV PATH="${IOTDB_AINODE_HOME}/sbin/:${IOTDB_AINODE_HOME}/tools/:${PATH}" + +RUN bash start-ainode.sh + +ENTRYPOINT ["/usr/bin/dumb-init", "--"] +CMD ["bash", "-c", "entrypoint.sh ainode"] + +LABEL build_date="$build_date" maintainer="$maintainer" version="$version" commit_id="$commit_id"