diff --git a/README.md b/README.md index d35ca7cab5faf9e6bbf3d22b9d3f7ac2090e4c1d..01de36634bed2740de37d5e1a73226d81afeb1da 100644 --- a/README.md +++ b/README.md @@ -87,6 +87,13 @@ $ yarn run dev http://your-ip:8081 ``` +## 一键部署最新版本 +1. 准备一台可以正常运行的linux服务器(支持MacOS) +2. 安装Docker 和 Docker Compose +```sh +curl -sSL https://raw.githubusercontent.com/go-atomci/atomci/master/deploy/docker-compose/quick_start.sh | bash +``` + ## 如何构建镜像 ### 前端 diff --git a/deploy/docker-compose/quick_start.sh b/deploy/docker-compose/quick_start.sh new file mode 100644 index 0000000000000000000000000000000000000000..73b4af178e5b2701b5a8284199cf96835c474bc3 --- /dev/null +++ b/deploy/docker-compose/quick_start.sh @@ -0,0 +1,54 @@ +#!/bin/bash + +# Install Latest ATOMCI Release + +os=`uname -a` +server_url="" +git_urls=('github.com' 'hub.fastgit.org') + +echo '正在检测可用服务器' +for git_url in ${git_urls[*]} +do + success="true" + for i in {1..3} + do + echo -ne "检测 ${git_url} ... ${i} " + curl -m 5 -kIs https://${git_url} >/dev/null + if [ $? != 0 ];then + echo "failed" + success="false" + break + else + echo "ok" + sleep 1s + fi + done + if [ ${success} == "true" ];then + server_url=${git_url} + break + fi +done + +if [ "x${server_url}" == "x" ];then + echo "没有找到稳定的下载服务器,请稍候重试" + exit 1 +fi + + +echo "使用下载服务器 ${server_url}" + +# 支持MacOS +if [[ $os =~ 'Darwin' ]];then + ATOMCIVERSION=$(curl -s https://${server_url}/go-atomci/atomci/releases/latest |grep -Eo '[0-9]+.[0-9]+.[0-9]+') +else + ATOMCIVERSION=$(curl -s https://${server_url}/go-atomci/atomci/releases/latest/download 2>&1 | grep -Po '[0-9]+\.[0-9]+\.[0-9]+.*(?=")') +fi + +echo '当前最新版本为:${ATOMCIVERSION} 开始下载...' +wget --no-check-certificate https://${server_url}/go-atomci/atomci/releases/download/v${ATOMCIVERSION}/atomci-${ATOMCIVERSION}-docker-compose.tgz +tar zxf atomci-${ATOMCIVERSION}-docker-compose.tgz +cd atomci-${ATOMCIVERSION} + +echo '开始部署' +docker-compose down && docker-compose up -d +/bin/bash init.sh \ No newline at end of file