diff --git a/sentinel-dashboard/Dockerfile b/sentinel-dashboard/Dockerfile new file mode 100644 index 00000000..b190d5f9 --- /dev/null +++ b/sentinel-dashboard/Dockerfile @@ -0,0 +1,10 @@ +FROM java:8 +MAINTAINER king <1609724385@qq.com> +VOLUME /tmp +COPY target/sentinel_dashboard.jar sentinel_dashboard.jar +COPY --from=hengyunabc/arthas:latest /opt/arthas /opt/arthas +ENV TimeZone=Asia/Shanghai +ENV active=dev +ENV JAVA_OPTS="-Xmx512M -Xms512M" +RUN ln -snf /usr/share/zoneinfo/$TimeZone /etc/localtime && echo $TimeZone > /etc/timezone +ENTRYPOINT java $JAVA_OPTS -Djava.security.egd=file:/dev/./urandom -jar /sentinel_dashboard.jar --spring.profiles.active=$active diff --git a/sentinel-dashboard/sentinel_dashboard_run.sh b/sentinel-dashboard/sentinel_dashboard_run.sh new file mode 100644 index 00000000..a6a95bf2 --- /dev/null +++ b/sentinel-dashboard/sentinel_dashboard_run.sh @@ -0,0 +1,31 @@ +#!/bin/bash +environment=$1 +version=$2 +echo "环境变量为${environment},版本为$version!" +if [[ ${environment} == 'pro' ]]; then + echo "开始远程构建容器" + docker stop sentinel_dashboard || true + docker rm sentinel_dashboard || true + docker rmi -f $(docker images | grep registry.cn-shanghai.aliyuncs.com/telpo_platform/sentinel_dashboard | awk '{print $3}') + + docker login --username=rzl_wangjx@1111649216405698 --password=telpo.123 registry.cn-shanghai.aliyuncs.com + docker pull registry.cn-shanghai.aliyuncs.com/telpo_platform/sentinel_dashboard:$version + docker run -e active=pro -p 8092:8092 -v /home/data/sentineldashboard/log:/var/log/sentineldashboard --restart=always -d --name sentinel_dashboard registry.cn-shanghai.aliyuncs.com/telpo_platform/sentinel_dashboard:$version + #删除产生的None镜像 + docker rmi -f $(docker images | grep none | awk '{print $3}') + docker ps -a +else + if [[ ${environment} == 'test' ]]; then + #echo "开始远程构建容器" + docker stop sentinel_dashboard || true + docker rm sentinel_dashboard || true + + docker rmi -f $(docker images | grep 139.224.254.18:5000/sentinel_dashboard | awk '{print $3}') + docker pull 139.224.254.18:5000/sentinel_dashboard:$version + docker run -v /home/data/sentineldashboard/log:/var/log/sentineldashboard -e active=test --restart=always -d --network host --name sentinel_dashboard 139.224.254.18:5000/sentinel_dashboard:$version + + #删除产生的None镜像 + docker rmi -f $(docker images | grep none | awk '{print $3}') + docker ps -a + fi +fi diff --git a/sentinel-dashboard/setup_pro.sh b/sentinel-dashboard/setup_pro.sh new file mode 100644 index 00000000..a492f6b1 --- /dev/null +++ b/sentinel-dashboard/setup_pro.sh @@ -0,0 +1,21 @@ +#!/usr/bin/env bash +mvn clean +mvn package -Dmaven.test.skip=true +image_version=$version +# 删除镜像 +docker rmi -f $( + docker images | grep registry.cn-shanghai.aliyuncs.com/telpo_platform/sentinel_dashboard | awk '{print $3}' +) +# 构建telpo/mrp:$image_version镜像 +docker build . -t telpo/sentinel_dashboard:$image_version +#TODO:推送镜像到阿里仓库 +echo '=================开始推送镜像=======================' +#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 tag telpo/sentinel_dashboard:$image_version registry.cn-shanghai.aliyuncs.com/telpo_platform/sentinel_dashboard:$image_version +docker push registry.cn-shanghai.aliyuncs.com/telpo_platform/sentinel_dashboard:$image_version +echo '=================推送镜像完成=======================' +#删除产生的None镜像 +docker rmi -f $(docker images | grep none | awk '{print $3}') +# 查看镜像列表 +docker images diff --git a/sentinel-dashboard/setup_test.sh b/sentinel-dashboard/setup_test.sh new file mode 100644 index 00000000..39491e76 --- /dev/null +++ b/sentinel-dashboard/setup_test.sh @@ -0,0 +1,27 @@ +#!/bin/bash +mvn clean +mvn package -Dmaven.test.skip=true +#image_version=$(date +%Y%m%d%H%M) +image_version=$version +docker stop sentinel_dashboard || true +docker rm sentinel_dashboard || true + +# 删除镜像 +# docker rmi -f $(docker images | grep telpo/sentinel_dashboard | awk '{print $3}') + +docker build . -t telpo/sentinel_dashboard:$image_version + +#TODO:推送镜像到私有仓库 +echo '=================开始推送镜像=======================' +docker tag telpo/sentinel_dashboard:$image_version 139.224.254.18:5000/sentinel_dashboard:$image_version +docker push 139.224.254.18:5000/sentinel_dashboard:$image_version +echo '=================推送镜像完成=======================' + +#删除产生的None镜像 +docker rmi -f $(docker images | grep none | awk '{print $3}') +# 查看镜像列表 +docker images +# 启动容器 +docker run -v /home/data/sentineldashboard/log:/var/log/sentineldashboard -d -e active=test --network host --restart=always --name sentinel_dashboard 139.224.254.18:5000/sentinel_dashboard:$image_version +# 查看日志 +# docker logs sentinel_dashboard