diff --git a/packaging/docker/DockerfileTDgpt b/packaging/docker/DockerfileTDgpt index 1fb46964aa..d577bdc779 100644 --- a/packaging/docker/DockerfileTDgpt +++ b/packaging/docker/DockerfileTDgpt @@ -1,25 +1,26 @@ FROM tdgpt_env:1.0 -WORKDIR /apps +WORKDIR /root ENV DEBIAN_FRONTEND=noninteractive ARG pkgFile ARG dirName -ARG nasIp -ADD ${pkgFile} \ - ${dirName} \ - http://${nasIp}/data/nas/TDengine/anode/taos.pth \ - http://${nasIp}/data/nas/TDengine/anode/taos_ts_server.py \ - http://${nasIp}/data/nas/TDengine/anode/fc_australia.sql \ - # http://${nasIp}/data/nas/TDengine/anode/timer-moe.tar.gz \ - /apps/ +ARG modelDlUrl + +# for timer-moe +# ADD ${modelDlUrl}/timer-moe.tar.gz /root/ +# RUN tar -xzf timer-moe.tar.gz && rm -rf timer-moe.tar.gz + +ADD ${pkgFile} \ + ${modelDlUrl}/taos.pth \ + ${modelDlUrl}/taos_ts_server.py \ + ${modelDlUrl}/fc_australia.sql \ + /root/ -# RUN tar -xzf timer-moe.tar.gz && \ -# rm -rf timer-moe.tar.gz && \ RUN cd ${dirName}/ && \ /bin/bash install.sh -e no && \ cd .. && \ rm -rf ${dirName} COPY entrypoint.sh /usr/local/bin/entrypoint.sh -RUN chmod +x /usr/local/bin/entrypoint.sh /apps/taos_ts_server.py +RUN chmod +x /usr/local/bin/entrypoint.sh /root/taos_ts_server.py EXPOSE 6090 8387 5000 ENTRYPOINT ["/usr/local/bin/entrypoint.sh"] diff --git a/packaging/docker/dockerbuild.sh b/packaging/docker/dockerbuild.sh index ee09854176..acea542b84 100755 --- a/packaging/docker/dockerbuild.sh +++ b/packaging/docker/dockerbuild.sh @@ -4,7 +4,7 @@ set -e #set -x -# dockerbuild.sh +# dockerbuild.sh # -c [aarch32 | aarch64 | amd64 | x86 | mips64 | loongarch64...] # -n [version number] # -p [password for docker hub] @@ -17,11 +17,13 @@ cpuTypeAlias="" version="" passWord="" pkgFile="" +tdgptPkgFile="" verType="stable" dockerLatest="n" cloudBuild="n" +modelDlUrl="" -while getopts "hc:n:p:f:V:a:b:d:" arg +while getopts "hc:n:p:f:V:g:u:a:b:d:" arg do case $arg in c) @@ -48,6 +50,14 @@ do #echo "verType=$OPTARG" verType=$(echo $OPTARG) ;; + g) + #echo "tdgptPkgFile=$OPTARG" + tdgptPkgFile=$(echo $OPTARG) + ;; + u) + #echo "modelDlUrl=$OPTARG" + modelDlUrl=$(echo $OPTARG) + ;; d) #echo "cloudBuild=$OPTARG" cloudBuild=$(echo $OPTARG) @@ -61,12 +71,14 @@ do echo " -n [version number] " echo " -p [password for docker hub] " echo " -V [stable | beta] " + echo " -g [pkg name for tdgpt] " + echo " -u [model download url] " echo " -f [pkg file] " echo " -a [y | n ] " echo " -d [cloud build ] " exit 0 ;; - ?) #unknow option + ?) #unknow option echo "unkonw argument" exit 1 ;; @@ -82,9 +94,15 @@ done if [ "$verType" == "beta" ]; then dockername=${cpuType}-${verType} dirName=${pkgFile%-beta*} + if [ -n "$tdgptPkgFile" ];then + tdgptDirName=${tdgptPkgFile%-beta*} + fi elif [ "$verType" == "stable" ]; then dockername=${cpuType} dirName=${pkgFile%-Linux*} + if [ -n "$tdgptPkgFile" ];then + tdgptDirName=${tdgptPkgFile%-Linux*} + fi else echo "unknow verType, nor stabel or beta" exit 1 @@ -103,7 +121,11 @@ communityDir=${scriptDir}/../../../community DockerfilePath=${communityDir}/packaging/docker/ if [ "$cloudBuild" == "y" ]; then communityArchiveDir=/nas/TDengine/v$version/cloud - Dockerfile=${communityDir}/packaging/docker/DockerfileCloud + if [ -n "$tdgptPkgFile" ];then + Dockerfile=${communityDir}/packaging/docker/DockerfileCloudTDgpt + else + Dockerfile=${communityDir}/packaging/docker/DockerfileCloud + fi else communityArchiveDir=/nas/TDengine/v$version/community Dockerfile=${communityDir}/packaging/docker/Dockerfile @@ -125,22 +147,36 @@ else fi # check the tdengine cloud base image existed or not if [ "$cloudBuild" == "y" ]; then - CloudBase=$(docker images | grep tdengine/tdengine-cloud-base ||:) - if [[ "$CloudBase" == "" ]]; then - echo "Rebuild tdengine cloud base image..." - docker build --rm -f "${communityDir}/packaging/docker/DockerfileCloud.base" -t tdengine/tdengine-cloud-base "." --build-arg cpuType=${cpuTypeAlias} + if [ -n "$tdgptPkgFile" ];then + CloudBase=$(docker images | grep tdengine/tdengine-cloud-tdgpt-base ||:) + if [[ "$CloudBase" == "" ]]; then + echo "Rebuild tdengine cloud tdgpt base image..." + docker build --rm -f "${communityDir}/packaging/docker/DockerfileCloudTDgpt.base" -t tdengine/tdengine-cloud-tdgpt-base "." --build-arg cpuType=${cpuTypeAlias} + else + echo "Already found tdengine cloud tdgpt base image" + fi else - echo "Already found tdengine cloud base image" + CloudBase=$(docker images | grep tdengine/tdengine-cloud-base ||:) + if [[ "$CloudBase" == "" ]]; then + echo "Rebuild tdengine cloud base image..." + docker build --rm -f "${communityDir}/packaging/docker/DockerfileCloud.base" -t tdengine/tdengine-cloud-base "." --build-arg cpuType=${cpuTypeAlias} + else + echo "Already found tdengine cloud base image" + fi fi fi -docker build --rm -f "${Dockerfile}" --network=host -t tdengine/tdengine-${dockername}:${version} "." --build-arg pkgFile=${pkgFile} --build-arg dirName=${dirName} --build-arg cpuType=${cpuTypeAlias} +if [ -n "$tdgptPkgFile" ];then + docker build --rm -f "${Dockerfile}" --network=host -t tdengine/tdengine-${dockername}:${version} "." --build-arg pkgFile=${pkgFile} --build-arg dirName=${dirName} --build-arg tdgptPkgFile=${tdgptPkgFile} --build-arg tdgptDirName=${tdgptDirName} --build-arg cpuType=${cpuTypeAlias} --build-arg modelDlUrl=${modelDlUrl} +else + docker build --rm -f "${Dockerfile}" --network=host -t tdengine/tdengine-${dockername}:${version} "." --build-arg pkgFile=${pkgFile} --build-arg dirName=${dirName} --build-arg cpuType=${cpuTypeAlias} +fi if [ "$cloudBuild" != "y" ]; then docker login -u tdengine -p ${passWord} #replace the docker registry username and password docker push tdengine/tdengine-${dockername}:${version} fi -# set this version to latest version +# set this version to latest version if [ "$cloudBuild" != "y" ] && [ ${dockerLatest} == 'y' ] ;then docker tag tdengine/tdengine-${dockername}:${version} tdengine/tdengine-${dockername}:latest docker push tdengine/tdengine-${dockername}:latest diff --git a/packaging/docker/entrypoint.sh b/packaging/docker/entrypoint.sh index d73309c1a4..06750ca8db 100755 --- a/packaging/docker/entrypoint.sh +++ b/packaging/docker/entrypoint.sh @@ -6,32 +6,36 @@ export LC_CTYPE=en_US.UTF-8 export LC_ALL=en_US.UTF-8 CONFIG_FILE="/usr/local/taos/taosanode/cfg/taosanode.ini" -TS_SERVER_FILE="/apps/taos_ts_server.py" -TIMER_POE_FILE="/apps/timer-moe/timer-moe_server.py" +TS_SERVER_FILE="/root/taos_ts_server.py" +TIMER_POE_FILE="/root/timer-moe/timer-moe_server.py" if [ ! -f "$CONFIG_FILE" ]; then echo "Error: Configuration file $CONFIG_FILE not found!" exit 1 fi -echo "Starting tdtsfm server..." -python3 $TS_SERVER_FILE --action server & -TAOS_TS_PID=$! -if ! ps -p $TAOS_TS_PID > /dev/null; then - echo "Error: tdtsfm server failed to start!" - exit 1 +if [ -f $TS_SERVER_FILE ];then + echo "Starting tdtsfm server..." + python3 $TS_SERVER_FILE --action server & + TAOS_TS_PID=$! + + if ! ps -p $TAOS_TS_PID > /dev/null; then + echo "Error: tdtsfm server failed to start!" + exit 1 + fi fi +if [ -f $TIMER_POE_FILE ];then + echo "Starting timer-moe server..." + cd $(dirname "$TIMER_POE_FILE") + python3 $TIMER_POE_FILE --action server & + TIMER_MOE_PID=$! -# echo "Starting timer-moe server..." -# cd /apps/timer-moe -# python3 $TIMER_POE_FILE --action server & -# TIMER_MOE_PID=$! - -# if ! ps -p $TIMER_MOE_PID > /dev/null; then -# echo "Error: timer-moe server failed to start!" -# exit 1 -# fi + if ! ps -p $TIMER_MOE_PID > /dev/null; then + echo "Error: timer-moe server failed to start!" + exit 1 + fi +fi echo "Starting uWSGI with config: $CONFIG_FILE" exec /usr/local/taos/taosanode/venv/bin/uwsgi --ini "$CONFIG_FILE"