提交 3b91cfcd 编写于 作者: Huan (李卓桓)'s avatar Huan (李卓桓)

docker runner support install dependence modules automaticly from package.json by yarn, with cache

上级 abb3645d
......@@ -26,7 +26,8 @@ RUN mkdir /wechaty
WORKDIR /wechaty
COPY package.json .
RUN npm --progress false install > /dev/null \
RUN npm --progress=false install > /dev/null \
&& npm --progress=false install -g yarn > /dev/null \
&& rm -fr /tmp/*
# && npm install ts-node typescript -g \
......@@ -35,7 +36,7 @@ RUN npm --progress false link
# Loading from node_modules Folders: https://nodejs.org/api/modules.html
# If it is not found there, then it moves to the parent directory, and so on, until the root of the file system is reached.
RUN mkdir /bot \
RUN ln -s /root /bot \
&& ln -s /usr/local/lib/node_modules / \
&& ln -s /wechaty/tsconfig.json /
......
......@@ -37,9 +37,20 @@ if [[ "$1" == *.ts || "$1" == *.js ]]; then
shift
if [ -f "$botFilePath" ]; then
cd /bot && pwd
[ -f package.json ] && {
echo "Install dependencies modules ..."
yarn
}
echo "Executing ts-node $botFilePath $@"
exec ts-node "$botFilePath" $@
exit $?
ts-node "$botFilePath" $@
ret=$?
figlet " Wechaty "
echo ____________________________________________________
echo " https://www.wechaty.io"
figlet " Exit $ret "
sleep 3
exit $ret
else
echo "ERROR: can not found bot file: $botFile"
exit -1
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册