enh: update DockerfileTDgpt and run-shell

This commit is contained in:
jiajingbin 2025-03-25 15:38:59 +08:00
parent 6648d2a502
commit 7a1191ef89
3 changed files with 81 additions and 40 deletions

View File

@ -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"]

View File

@ -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,6 +71,8 @@ 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 ] "
@ -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
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,6 +147,15 @@ else
fi
# check the tdengine cloud base image existed or not
if [ "$cloudBuild" == "y" ]; then
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
CloudBase=$(docker images | grep tdengine/tdengine-cloud-base ||:)
if [[ "$CloudBase" == "" ]]; then
echo "Rebuild tdengine cloud base image..."
@ -132,9 +163,14 @@ if [ "$cloudBuild" == "y" ]; then
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}

View File

@ -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
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"