代码拉取完成,页面将自动刷新
#!/bin/bash
function green_printf () {
printf "\e[32m$@\e[m\n"
}
function red_printf () {
printf "\e[31m$@\e[m\n"
}
function panic () {
echo
red_printf "$@"
echo
exit 1
}
function panic_fail_op () {
panic "Operation failed! Exit."
}
cd $(git rev-parse --show-toplevel)
function build() {
green_printf "Before building, first cleaning... \n"
clean || panic_fail_op
green_printf "Building omniparser image ... \n"
docker build -t omniparser-cli-server . || panic_fail_op
green_printf "Launching omniparser ... \n"
docker run -d -p 8080:8080 omniparser-cli-server || panic_fail_op
green_printf "Showing omniparser logs ... \n"
docker ps --filter="ancestor=omniparser-cli-server" --format="{{.ID}}" | xargs docker logs -f
}
function clean() {
green_printf "Stopping/removing all omniparser containers ... \n"
docker ps --filter="ancestor=omniparser-cli-server" --format="{{.ID}}" | \
xargs docker rm --force || true
green_printf "Removing all omniparser images ... \n"
docker images --filter "reference=omniparser-cli-server:*" --format "{{.ID}}" | \
xargs docker rmi --force || true
green_printf "Cleaning complete.\n"
}
if [ "$1" = "build" ]; then
CMD="build"
elif [ "$1" = "clean" ]; then
CMD="clean"
elif [ -z "$1" ]; then
CMD="clean"
else
panic "Error: unknown arg '$1'" >&2
fi
if [ $CMD = 'build' ]; then
build
else
clean
fi
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。