• Dockerfile 构建后端springboot应用并用shell脚本实现jenkins自动构建


    Dockerfile  文件构建docker镜像
    
    
    FROM centos
    MAINTAINER zh*****eng "z*******ch.cn"
    
    
    ENV LANG en_US.UTF-8
    
    RUN /bin/cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && echo 'Asia/Shanghai' >/etc/timezone
    
    WORKDIR /home
    
    RUN mkdir JDK
    
    
    COPY jdk-8u181-linux-x64.tar.gz /home/
    COPY weifeng.jar /home/
    
    
    RUN tar zxf /home/jdk-8u181-linux-x64.tar.gz -C /home/JDK 
    
    
    ENV JAVA_HOME /home/JDK/jdk1.8.0_181
    ENV PATH $PATH:$JAVA_HOME/bin
    
    
    EXPOSE 8080
    
    WORKDIR /home/JDK
    
    ENTRYPOINT ["java","-jar","/home/weifeng.jar"," -Xms512m","-Xmx2048m","--spring.profiles.active=dev","--server.port=8080"]
    

      

    shell  脚本实现jenkins上自动构建阿里云k8s上应用
    
    
    #!/bin/bash
    
    mv  /mnt/workspace/weifeng-dev/weifeng-web/target/weifeng.jar  /mnt/workspace/weifeng-dev/dockerfile/
    
    cd /mnt/workspace/weifeng-dev/dockerfile/
    
    sudo docker build -t weifeng-dev -f Dockerfile.dev .
    
    sudo docker login --username=**** -p ******* registry-vpc.*****.aliyuncs.com
    
    sudo docker tag weifeng-dev registry-vpc.******.aliyuncs.com/weifeng-system/weifeng-dev
    
    sudo docker push  registry-vpc.******.aliyuncs.com/weifeng-system/weifeng-dev
    curl https://cs.console.aliyun.com/hook/t**********n-uzNGKvYTOAgQrWw2p7rQpfBsIX7_Chii7g51y5zbOsu_F8whppyT20ZBmX8Dc2esYw09s
    
    if [ $? -eq 0 ]; then
    
       echo -e "33[32m[ the application weifeng-dev successfully deployed  ]33[0m"
    
    else
        echo -e "33[31m33[01m[ the application weifeng-dev deploy failed  ]33[0m"
    
    fi
    

      

  • 相关阅读:
    Swift学习-Property
    Swift学习-protocol
    Swift学习-Class
    Swift学习-Enumerate、Structure
    iOS“此时无法下载应用”解决办法
    iTunes Connect用户职能与权限
    TestFlight Beta Testing 开发指南中英对照
    梳理一下KVC
    mac下使用github 上传代码(转)
    运用Runtime全局修改UILabel的默认字体
  • 原文地址:https://www.cnblogs.com/weifeng1463/p/10355906.html
Copyright © 2020-2023  润新知