Selaa lähdekoodia

添加Jenkins配置文件

master
wangjx 3 vuotta sitten
vanhempi
commit
98fc843d17
4 muutettua tiedostoa jossa 89 lisäystä ja 0 poistoa
  1. +10
    -0
      sentinel-dashboard/Dockerfile
  2. +31
    -0
      sentinel-dashboard/sentinel_dashboard_run.sh
  3. +21
    -0
      sentinel-dashboard/setup_pro.sh
  4. +27
    -0
      sentinel-dashboard/setup_test.sh

+ 10
- 0
sentinel-dashboard/Dockerfile Näytä tiedosto

@@ -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

+ 31
- 0
sentinel-dashboard/sentinel_dashboard_run.sh Näytä tiedosto

@@ -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

+ 21
- 0
sentinel-dashboard/setup_pro.sh Näytä tiedosto

@@ -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

+ 27
- 0
sentinel-dashboard/setup_test.sh Näytä tiedosto

@@ -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

Loading…
Peruuta
Tallenna