1
0
mirror of https://github.com/142vip/408CSFamily.git synced 2026-04-13 17:09:45 +08:00

refactor(script):脚本配置文件修改

- 提供页面部署脚本
- Dockerfile修改,优化构建步骤
- nginx配置文件修改,自定义端口
-
This commit is contained in:
喜欢芝士的妹妹
2022-06-22 09:28:12 +08:00
parent 6d363326a0
commit 3f7784318d
4 changed files with 96 additions and 7 deletions

View File

@@ -15,6 +15,8 @@ readonly warnLogger="\033[1;33m"
readonly currentTime=$(date "+%Y-%m-%d %H:%M:%S")
## 项目名称
readonly projectName="408CSFamily"
## 仓库地址
readonly repoAddress="registry.cn-hangzhou.aliyuncs.com/142vip/doc_book:"
## 版本号
version=${1}
@@ -28,7 +30,7 @@ prepare_check(){
run(){
echo -e "${successLogger}---------------- shell doc_book start ---------------- "
docker build -t registry.cn-hangzhou.aliyuncs.com/142vip/doc_book:"${projectName}_${version}" .
docker build -t "${repoAddress}${projectName}_${version}" .
echo -e "${successLogger}---------------- shell doc_book end ---------------- "
push_docker_image
}
@@ -38,14 +40,14 @@ run(){
push_docker_image(){
if [[ "$(docker images -q registry.cn-hangzhou.aliyuncs.com/142vip/doc_book:"${projectName}_${version}" 2> /dev/null)" != "" ]];
if [[ "$(docker images -q "${repoAddress}${projectName}_${version}" 2> /dev/null)" != "" ]];
then
## 推送
docker push registry.cn-hangzhou.aliyuncs.com/142vip/doc_book:"${projectName}_${version}"
docker push "${repoAddress}${projectName}_${version}"
echo -e "${successLogger}---------------- 上传镜像成功,删除本地镜像 ---------------- "
docker rmi registry.cn-hangzhou.aliyuncs.com/142vip/doc_book:"${projectName}_${version}"
docker rmi "${repoAddress}${projectName}_${version}"
else
echo -e "${errorLogger}${currentTime}:镜像:registry.cn-hangzhou.aliyuncs.com/142vip/doc_book:${projectName}_${version}不存在"
echo -e "${errorLogger}${currentTime}:镜像:${repoAddress}${projectName}_${version}不存在"
fi
exit 0
}

44
scripts/page_deploy.sh Normal file
View File

@@ -0,0 +1,44 @@
#!/usr/bin/env sh
###
# @Description: 静态资源网站部署脚本
# @Version: Beta1.0
# @Author: 【B站&公众号】Rong姐姐好可爱
# @Date: 2021-02-19 22:34:57
# @LastEditors: 【B站&公众号】Rong姐姐好可爱
# @LastEditTime: 2022-04-18 23:35:15
###
commitInfo=${1}
set -e
# 进入上级目录,并编译
npm run build
## 切换到dist文件目录
cd docs/.vuepress/dist
git init
git add -A
## 如果没有输入commit信息则采用默认
if [ "${commitInfo}" -eq "" ]; then
commitInfo="408CSFamily page init"
fi
git commit -m "refactor:${commitInfo}"
## 配置个人信息
git config user.name "喜欢吃芝士葡萄的妹妹"
git config user.email "fairy0115@2925.com"
# if you are deploying to https://<USERNAME>.github.io
# git push -f git@github.com:<USERNAME>/<USERNAME>.github.io.git master
# if you are deploying to https://<USERNAME>.github.io/<REPO>
git push -f https://github.com/mmdapl/JavaScriptCollection.git master:pages/github
cd -