From 1aa664a7460eccef6d9dee2153c3fdcec1da1db0 Mon Sep 17 00:00:00 2001 From: JinxChen <2183691628@qq.com> Date: Fri, 25 Feb 2022 15:02:32 +0800 Subject: [PATCH] =?UTF-8?q?-=20=E5=A2=9E=E5=8A=A0=20=E7=8E=AF=E5=A2=83?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E8=84=9A=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 5 +++-- setup_development.sh | 27 +++++++++++++++++++++++++++ setup_production.sh | 30 ++++++++++++++++++++++++++++++ setup_test.sh | 29 +++++++++++++++++++++++++++++ 4 files changed, 89 insertions(+), 2 deletions(-) create mode 100644 setup_development.sh create mode 100644 setup_production.sh create mode 100644 setup_test.sh diff --git a/README.md b/README.md index eea838d..1c3b547 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ @@ -49,4 +49,5 @@ build - 初版发布 - 完成 项目搭建 - 完成 项目迁移 从documentFrontEndWeb 到 AlipayFrontendWeb -- 增加 docker部署脚本 \ No newline at end of file +- 增加 docker部署脚本 +- 增加 环境设置脚本 \ No newline at end of file diff --git a/setup_development.sh b/setup_development.sh new file mode 100644 index 0000000..e8b4fcd --- /dev/null +++ b/setup_development.sh @@ -0,0 +1,27 @@ +### + # @Author: your name + # @Date: 2020-07-02 10:34:00 + # @LastEditTime: 2022-02-25 15:01:41 + # @LastEditors: JinxChen + # @Description: In User Settings Edit + # @FilePath: \AntpayFrontEnd\setup_development.sh +### +#!/bin/bash +npm -v +npm config set registry https://registry.npm.taobao.org +npm install +npm run build-dev +image_version=`date +%Y%m%d%H%M`; +docker stop antpay_frontend_web || true; +docker rm antpay_frontend_web || true; +# 删除镜像 +docker rmi -f $(docker images | grep telpo/antpay_frontend_web | awk '{print $3}') +# 构建telpo/mrp:$image_version镜像 +docker build --no-cache . -t telpo/antpay_frontend_web:$image_version; +#删除产生的None镜像 +docker rmi -f $(docker images | grep none | awk '{print $3}') +# 查看镜像列表 +docker images; +docker run -p 8804:80 -d --restart=always --name antpay_frontend_web telpo/antpay_frontend_web:$image_version; +# 查看日志 +docker logs antpay_frontend_web; \ No newline at end of file diff --git a/setup_production.sh b/setup_production.sh new file mode 100644 index 0000000..bb6b93d --- /dev/null +++ b/setup_production.sh @@ -0,0 +1,30 @@ +### + # @Author: your name + # @Date: 2020-07-02 10:34:59 + # @LastEditTime: 2022-02-25 15:01:53 + # @LastEditors: JinxChen + # @Description: In User Settings Edit + # @FilePath: \AntpayFrontEnd\setup_production.sh +### +#!/bin/bash +npm -v +npm config set registry https://registry.npm.taobao.org +npm install +npm run build +image_version=$version; +# 删除镜像 + docker rmi -f $(docker images | grep registry.cn-shanghai.aliyuncs.com/tolpo_platform/antpay_frontend_web | awk '{print $3}') +# 构建telpo/mrp:$image_version镜像 +docker build --no-cache . -t telpo/antpay_frontend_web:$image_version; +#TODO:推送镜像到阿里仓库 +echo '=================开始推送镜像=======================' +#docker login --username=telpo_linwl@1111649216405698 --password=telpo#1234 registry.cn-shanghai.aliyuncs.com +#docker login --username=telpo_fengjj@1111649216405698 --password=PWDaliyun123 registry.cn-shanghai.aliyuncs.com +docker login --username=rzl_wangjx@1111649216405698 --password=telpo.123 registry.cn-shanghai.aliyuncs.com +docker tag telpo/antpay_frontend_web:$image_version registry.cn-shanghai.aliyuncs.com/tolpo_platform/antpay_frontend_web:$image_version +docker push registry.cn-shanghai.aliyuncs.com/tolpo_platform/antpay_frontend_web:$image_version +echo '=================推送镜像完成=======================' +#删除产生的None镜像 +docker rmi -f $(docker images | grep none | awk '{print $3}') +# 查看镜像列表 +docker images; \ No newline at end of file diff --git a/setup_test.sh b/setup_test.sh new file mode 100644 index 0000000..2899222 --- /dev/null +++ b/setup_test.sh @@ -0,0 +1,29 @@ +### + # @Author: your name + # @Date: 2020-07-02 10:34:59 + # @LastEditTime: 2022-02-25 15:02:07 + # @LastEditors: JinxChen + # @Description: In User Settings Edit + # @FilePath: \AntpayFrontEnd\setup_test.sh +### +#!/bin/bash +npm -v +npm config set registry https://registry.npm.taobao.org +npm install +npm run build-test +image_version=$version; +# 删除镜像 +docker rmi -f $( + docker images | grep 139.224.254.18:5000/antpay_frontend_web | awk '{print $3}' +) +# 构建telpo/mrp:$image_version镜像 +docker build --no-cache . -t telpo/antpay_frontend_web:$image_version; +#TODO:推送镜像到私有仓库 +echo '=================开始推送镜像=======================' +docker tag telpo/antpay_frontend_web:$image_version 139.224.254.18:5000/antpay_frontend_web:$image_version +docker push 139.224.254.18:5000/antpay_frontend_web:$image_version +echo '=================推送镜像完成=======================' +#删除产生的None镜像 +docker rmi -f $(docker images | grep none | awk '{print $3}') +# 查看镜像列表 +docker images; \ No newline at end of file