@@ -2,8 +2,8 @@ | |||||
### | ### | ||||
# @Date: 2021-11-15 09:37:49 | # @Date: 2021-11-15 09:37:49 | ||||
# @LastEditors: JinxuChen | # @LastEditors: JinxuChen | ||||
# @LastEditTime: 2021-12-02 09:20:59 | |||||
# @FilePath: \GpsCardAdmin\gps_card_admin.sh | |||||
# @LastEditTime: 2021-12-02 15:19:14 | |||||
# @FilePath: \GpsCardAdmin\gps_card_admin_run.sh | |||||
# @description: 功能 | # @description: 功能 | ||||
### | ### | ||||
environment=$1 | environment=$1 | ||||
@@ -11,24 +11,24 @@ version=$2 | |||||
echo "环境变量为${environment},版本为$version!" | echo "环境变量为${environment},版本为$version!" | ||||
if [[ ${environment} = 'production' ]]; then | if [[ ${environment} = 'production' ]]; then | ||||
echo "开始远程构建容器" | echo "开始远程构建容器" | ||||
docker stop gps_card_admin || true; | |||||
docker rm gps_card_admin || true; | |||||
docker rmi -f $(docker images | grep registry.cn-shanghai.aliyuncs.com/gps_card/gps_card_admin | awk '{print $3}') | |||||
docker stop gps_card_admin_web || true; | |||||
docker rm gps_card_admin_web || true; | |||||
docker rmi -f $(docker images | grep registry.cn-shanghai.aliyuncs.com/gps_card/gps_card_admin_web | awk '{print $3}') | |||||
#docker login --username=telpo_linwl@1111649216405698 --password=telpo#1234 registry.cn-shanghai.aliyuncs.com; | #docker login --username=telpo_linwl@1111649216405698 --password=telpo#1234 registry.cn-shanghai.aliyuncs.com; | ||||
docker login --username=rzl_wangjx@1111649216405698 --password=telpo.123 registry.cn-shanghai.aliyuncs.com | docker login --username=rzl_wangjx@1111649216405698 --password=telpo.123 registry.cn-shanghai.aliyuncs.com | ||||
docker pull registry.cn-shanghai.aliyuncs.com/gps_card/gps_card_admin:$version | |||||
docker run -p 8802:80 -d --restart=always --name gps_card_admin registry.cn-shanghai.aliyuncs.com/gps_card/gps_card_admin:$version; | |||||
docker pull registry.cn-shanghai.aliyuncs.com/gps_card/gps_card_admin_web:$version | |||||
docker run -p 8803:80 -d --restart=always --name gps_card_admin_web registry.cn-shanghai.aliyuncs.com/gps_card/gps_card_admin_web:$version; | |||||
#删除产生的None镜像 | #删除产生的None镜像 | ||||
docker rmi -f $(docker images | grep none | awk '{print $3}') | docker rmi -f $(docker images | grep none | awk '{print $3}') | ||||
docker ps -a | docker ps -a | ||||
elif [[ ${environment} == 'test' ]]; then | elif [[ ${environment} == 'test' ]]; then | ||||
echo "开始在测试环境远程构建容器" | echo "开始在测试环境远程构建容器" | ||||
docker stop gps_card_admin || true | |||||
docker rm gps_card_admin || true | |||||
docker rmi -f $(docker images | grep 139.224.254.18:5000/gps_card_admin | awk '{print $3}') | |||||
docker pull 139.224.254.18:5000/gps_card_admin:$version | |||||
docker run -p 8802:80 -d --restart=always --name gps_card_admin 139.224.254.18:5000/gps_card_admin:$version; | |||||
docker stop gps_card_admin_web || true | |||||
docker rm gps_card_admin_web || true | |||||
docker rmi -f $(docker images | grep 139.224.254.18:5000/gps_card_admin_web | awk '{print $3}') | |||||
docker pull 139.224.254.18:5000/gps_card_admin_web:$version | |||||
docker run -p 8803:80 -d --restart=always --name gps_card_admin_web 139.224.254.18:5000/gps_card_admin_web:$version; | |||||
#删除产生的None镜像 | #删除产生的None镜像 | ||||
docker rmi -f $(docker images | grep none | awk '{print $3}') | docker rmi -f $(docker images | grep none | awk '{print $3}') | ||||
docker ps -a | docker ps -a | ||||
@@ -1,7 +1,7 @@ | |||||
### | ### | ||||
# @Author: JinxuChen | # @Author: JinxuChen | ||||
# @Date: 2021-11-15 | # @Date: 2021-11-15 | ||||
# @LastEditTime: 2021-12-02 09:21:48 | |||||
# @LastEditTime: 2021-12-02 15:19:22 | |||||
# @LastEditors: JinxuChen | # @LastEditors: JinxuChen | ||||
# @Description: In User Settings Edit | # @Description: In User Settings Edit | ||||
# @FilePath: \GpsCardAdmin\setup_development.sh | # @FilePath: \GpsCardAdmin\setup_development.sh | ||||
@@ -13,18 +13,18 @@ npm config list | |||||
npm install | npm install | ||||
npm run build-test | npm run build-test | ||||
image_version=`date +%Y%m%d%H%M`; | image_version=`date +%Y%m%d%H%M`; | ||||
docker stop gps_card_admin || true; | |||||
docker stop gps_card_admin_web || true; | |||||
# 删除gps_parent_web容器 | # 删除gps_parent_web容器 | ||||
docker rm gps_card_admin || true; | |||||
docker rm gps_card_admin_web || true; | |||||
# 删除镜像 | # 删除镜像 | ||||
docker rmi -f $(docker images | grep telpo/gps_card_admin | awk '{print $3}') | |||||
# 构建telpo/gps_card_admin:$image_version镜像 | |||||
docker build . -t telpo/gps_card_admin:$image_version; | |||||
docker rmi -f $(docker images | grep telpo/gps_card_admin_web | awk '{print $3}') | |||||
# 构建telpo/gps_card_admin_web:$image_version镜像 | |||||
docker build . -t telpo/gps_card_admin_web:$image_version; | |||||
#删除产生的None镜像 | #删除产生的None镜像 | ||||
docker rmi -f $(docker images | grep none | awk '{print $3}') | docker rmi -f $(docker images | grep none | awk '{print $3}') | ||||
# 查看镜像列表 | # 查看镜像列表 | ||||
docker images; | docker images; | ||||
# 启动容器 | # 启动容器 | ||||
docker run -p 8802:80 -d --restart=always --name gps_card_admin telpo/gps_card_admin:$image_version; | |||||
docker run -p 8803:80 -d --restart=always --name gps_card_admin_web telpo/gps_card_admin_web:$image_version; | |||||
# 查看日志 | # 查看日志 | ||||
docker logs gps_card_admin; | |||||
docker logs gps_card_admin_web; |
@@ -1,7 +1,7 @@ | |||||
### | ### | ||||
# @Author: JinxuChen | # @Author: JinxuChen | ||||
# @Date: 2021-11-15 | # @Date: 2021-11-15 | ||||
# @LastEditTime: 2021-12-02 09:22:02 | |||||
# @LastEditTime: 2021-12-02 15:17:27 | |||||
# @LastEditors: JinxuChen | # @LastEditors: JinxuChen | ||||
# @Description: In User Settings Edit | # @Description: In User Settings Edit | ||||
# @FilePath: \GpsCardAdmin\setup_production.sh | # @FilePath: \GpsCardAdmin\setup_production.sh | ||||
@@ -12,15 +12,15 @@ npm install | |||||
npm run build | npm run build | ||||
image_version=$version; | image_version=$version; | ||||
# 删除镜像 | # 删除镜像 | ||||
docker rmi -f $(docker images | grep registry.cn-shanghai.aliyuncs.com/gps_card/gps_card_admin | awk '{print $3}') | |||||
docker rmi -f $(docker images | grep registry.cn-shanghai.aliyuncs.com/gps_card/gps_card_admin_web | awk '{print $3}') | |||||
docker build . -t telpo/gps_card_admin:$image_version; | |||||
docker build . -t telpo/gps_card_admin_web:$image_version; | |||||
#TODO:推送镜像到阿里仓库 | #TODO:推送镜像到阿里仓库 | ||||
echo '=================开始推送镜像=======================' | echo '=================开始推送镜像=======================' | ||||
#docker login --username=telpo_linwl@1111649216405698 --password=telpo#1234 registry.cn-shanghai.aliyuncs.com; | #docker login --username=telpo_linwl@1111649216405698 --password=telpo#1234 registry.cn-shanghai.aliyuncs.com; | ||||
docker login --username=rzl_wangjx@1111649216405698 --password=telpo.123 registry.cn-shanghai.aliyuncs.com | docker login --username=rzl_wangjx@1111649216405698 --password=telpo.123 registry.cn-shanghai.aliyuncs.com | ||||
docker tag telpo/gps_card_admin:$image_version registry.cn-shanghai.aliyuncs.com/gps_card/gps_card_admin:$image_version | |||||
docker push registry.cn-shanghai.aliyuncs.com/gps_card/gps_card_admin:$image_version | |||||
docker tag telpo/gps_card_admin_web:$image_version registry.cn-shanghai.aliyuncs.com/gps_card/gps_card_admin_web:$image_version | |||||
docker push registry.cn-shanghai.aliyuncs.com/gps_card/gps_card_admin_web:$image_version | |||||
echo '=================推送镜像完成=======================' | echo '=================推送镜像完成=======================' | ||||
#删除产生的None镜像 | #删除产生的None镜像 | ||||
docker rmi -f $(docker images | grep none | awk '{print $3}') | docker rmi -f $(docker images | grep none | awk '{print $3}') | ||||
@@ -1,7 +1,7 @@ | |||||
### | ### | ||||
# @Author: JinxuChen | # @Author: JinxuChen | ||||
# @Date: 2021-11-15 | # @Date: 2021-11-15 | ||||
# @LastEditTime: 2021-12-02 09:22:16 | |||||
# @LastEditTime: 2021-12-02 15:17:38 | |||||
# @LastEditors: JinxuChen | # @LastEditors: JinxuChen | ||||
# @Description: In User Settings Edit | # @Description: In User Settings Edit | ||||
# @FilePath: \GpsCardAdmin\setup_test.sh | # @FilePath: \GpsCardAdmin\setup_test.sh | ||||
@@ -16,14 +16,14 @@ npm run build-test | |||||
image_version=$version | image_version=$version | ||||
# 删除镜像 | # 删除镜像 | ||||
docker rmi -f $( | docker rmi -f $( | ||||
docker images | grep 139.224.254.18:5000/gps_card_admin | awk '{print $3}' | |||||
docker images | grep 139.224.254.18:5000/gps_card_admin_web | awk '{print $3}' | |||||
) | ) | ||||
# 构建gps_card_admin:$image_version镜像 | # 构建gps_card_admin:$image_version镜像 | ||||
docker build . -t telpo/gps_card_admin:$image_version; | |||||
docker build . -t telpo/gps_card_admin_web:$image_version; | |||||
#TODO:推送镜像到私有仓库 | #TODO:推送镜像到私有仓库 | ||||
echo '=================开始推送镜像=======================' | echo '=================开始推送镜像=======================' | ||||
docker tag telpo/gps_card_admin:$image_version 139.224.254.18:5000/gps_card_admin:$image_version | |||||
docker push 139.224.254.18:5000/gps_card_admin:$image_version | |||||
docker tag telpo/gps_card_admin_web:$image_version 139.224.254.18:5000/gps_card_admin_web:$image_version | |||||
docker push 139.224.254.18:5000/gps_card_admin_web:$image_version | |||||
echo '=================推送镜像完成=======================' | echo '=================推送镜像完成=======================' | ||||
#删除产生的None镜像 | #删除产生的None镜像 | ||||
docker rmi -f $(docker images | grep none | awk '{print $3}') | docker rmi -f $(docker images | grep none | awk '{print $3}') | ||||