feat(build): merge build script from feature plugin

This commit is contained in:
LinkinStars 2023-03-27 14:43:17 +08:00
parent 072bf002c2
commit c976b79bfd
3 changed files with 37 additions and 3 deletions

View File

@ -25,9 +25,11 @@ ARG CGO_EXTRA_CFLAGS
COPY . ${BUILD_DIR}
WORKDIR ${BUILD_DIR}
COPY --from=node-builder /tmp/build ${BUILD_DIR}/ui/build
RUN apk --no-cache add build-base git \
&& make clean build \
&& cp answer /usr/bin/answer
RUN apk --no-cache add build-base git bash \
&& make clean build
RUN chmod 755 answer
RUN ["/bin/bash","-c","script/build_plugin.sh"]
RUN cp answer /usr/bin/answer
RUN mkdir -p /data/uploads && chmod 777 /data/uploads \
&& mkdir -p /data/i18n && cp -r i18n/*.yaml /data/i18n

31
script/build_plugin.sh Normal file
View File

@ -0,0 +1,31 @@
#!/bin/bash
plugin_file=./script/plugin_list
if [ ! -f "$plugin_file" ]; then
echo "plugin_list is not exist"
exit 0
fi
num=0
for line in `cat $plugin_file`
do
account=$line
accounts[$num]=$account
((num++))
done
if [ $num -eq 0 ]; then
echo "plugin_list is null"
exit 0
fi
cmd="./answer build "
for repo in ${accounts[@]}
do
echo ${repo}
cmd=$cmd" --with "${repo}
done
$cmd
if [ ! -f "./new_answer" ]; then
echo "new_answer is not exist build failed"
exit 0
fi
rm answer
mv new_answer answer
./answer plugin

1
script/plugin_list Normal file
View File

@ -0,0 +1 @@
github.com/answerdev/plugins/connector/basic@latest