Debian更换国内镜像源|Debian换源|换源|JenkinsFile

deb http://mirrors.163.com/debian/ buster main non-free contrib
deb http://mirrors.163.com/debian/ buster-updates main non-free contrib
deb http://mirrors.163.com/debian/ buster-backports main non-free contrib
deb-src http://mirrors.163.com/debian/ buster main non-free contrib
deb-src http://mirrors.163.com/debian/ buster-updates main non-free contrib
deb-src http://mirrors.163.com/debian/ buster-backports main non-free contrib
deb http://mirrors.163.com/debian-security/ buster/updates main non-free contrib
deb-src http://mirrors.163.com/debian-security/ buster/updates main non-free contrib

Linux Ubuntu换源 Debian换源 更新源 Echo换源 sed 换源 Docker Ubuntu换源 Docker Debian换源

RUN echo 'deb http://mirrors.163.com/debian/ buster main non-free contrib\\r\\ndeb http://mirrors.163.com/debian/ buster-updates main non-free contrib\\r\\ndeb http://mirrors.163.com/debian/ buster-backports main non-free contrib\\r\\ndeb-src http://mirrors.163.com/debian/ buster main non-free contrib\\r\\ndeb-src http://mirrors.163.com/debian/ buster-updates main non-free contrib\\r\\ndeb-src http://mirrors.163.com/debian/ buster-backports main non-free contrib\\r\\ndeb http://mirrors.163.com/debian-security/ buster/updates main non-free contrib\\r\\ndeb-src http://mirrors.163.com/debian-security/ buster/updates main non-free contrib\\r\\n' > /etc/apt/sources.list && apt-get update -y && apt-get upgrade -y
/*  MAINTAINER WinJayX <WinJayX@Gmail.com>
 *  LABEL description="This is FZ_CaseCenter_Web Project"
 */
 

stage('Git Checkout') {
    node('MSBuild') {
       checkout([$class: 'GitSCM', branches: [[name: '${Branch}']], doGenerateSubmoduleConfigurations: false, extensions: [], submoduleCfg: [], userRemoteConfigs: [[credentialsId: '8888888-8888-8888-8888-888888fe66', url: 'https://git.nercoa.com/fz/other/classteachercaselibrary.git']]])
    }
}

stage('Build'){
    node('MSBuild') {
       echo '编译解决方案'
       bat "$DOTNET publish  -c Release -o \"${WORKSPACE}/publish\" \"src/NERC.ClassTeacherCaseLibrary/NERC.ClassTeacherCaseLibrary.FrontEnd/NERC.ClassTeacherCaseLibrary.FrontEnd.csproj\" "
    }
}

stage('Backup To The Site Directory'){
    node('MSBuild') {
        dir('publish') {
            bat "zip -r ${BUILD_NUMBER}.zip ./"
        }
        echo '拷贝文件至备份目录'
        bat "xcopy \"publish/${BUILD_NUMBER}.zip\" \"${BACKUP_SHARE_DIR}/${JOB_NAME}/\" /fyi "
        bat "rm -rf publish*"        
   }
}

stage('Download Project Code'){
    node('Container') {
        echo '建立业务目录'
        //sh "mkdir -p ${JOB_NAME} && cd ${JOB_NAME}"
        echo '下载程序'
        sh "curl -O ${PUBLISH_HOST}/${JOB_NAME}/${BUILD_NUMBER}.zip"
        echo '解压源程序'
        sh "unzip -o ${BUILD_NUMBER}.zip && rm -f ${BUILD_NUMBER}.zip"
    }
}    

stage('Build And Push Image') {
    node('Container') { 
sh '''
REPOSITORY=hub.nercoa.com/case-center/web:${ImageTag}
cat > Dockerfile << EOF
FROM mcr.microsoft.com/dotnet/aspnet
MAINTAINER WinJayX <WinJayX@Gmail.com>
LABEL description="This is FZ_CaseCenter_Web Project"
LABEL version="5.0.7"
USER root

RUN echo 'deb http://mirrors.163.com/debian/ buster main non-free contrib\\r\\ndeb http://mirrors.163.com/debian/ buster-updates main non-free contrib\\r\\ndeb http://mirrors.163.com/debian/ buster-backports main non-free contrib\\r\\ndeb-src http://mirrors.163.com/debian/ buster main non-free contrib\\r\\ndeb-src http://mirrors.163.com/debian/ buster-updates main non-free contrib\\r\\ndeb-src http://mirrors.163.com/debian/ buster-backports main non-free contrib\\r\\ndeb http://mirrors.163.com/debian-security/ buster/updates main non-free contrib\\r\\ndeb-src http://mirrors.163.com/debian-security/ buster/updates main non-free contrib\\r\\n' > /etc/apt/sources.list

RUN cat /etc/apt/sources.list

RUN apt-get update -y && apt-get upgrade -y
RUN apt-get install libgdiplus -y && ln -s libgdiplus.so gdiplus.dll
RUN ln -s /lib/x86_64-linux-gnu/libdl-2.24.so /lib/x86_64-linux-gnu/libdl.so
### 对连接sqlServer协议进行降级 
RUN sed -i 's/TLSv1.2/TLSv1/g' /etc/ssl/openssl.cnf &&\
    sed -i 's/LEVEL=2/LEVEL=1/g' /etc/ssl/openssl.cnf

WORKDIR /app
COPY . /app/
ENTRYPOINT ["dotnet", "NERC.ClassTeacherCaseLibrary.FrontEnd.dll"]
EOF



docker build -t $REPOSITORY .
docker login hub.nercoa.com -u username -p 8888888
docker push $REPOSITORY
'''
    }
}

stage('Deploy To The Test Server') {
    node('Container') { 
        sh '''
        REPOSITORY=hub.nercoa.com/case-center/web:${ImageTag}
        docker rm -f FZ_CaseCenter_Web || true
        docker container run -d \
        --volume /etc/localtime:/etc/localtime:ro \
        --restart always \
        --user root \
        --name FZ_CaseCenter_Web \
        --hostname FZ_CaseCenter_Web \
        -p 8004:80 $REPOSITORY
        '''
    }
}

stage('Deploying To The Production Server'){
    timeout(time: 1, unit: 'DAYS') {
    input message: 'Deploying To The Production Server?', ok: 'Deployment'
    }
}

stage('Deploy To The Production Docker Server') {
    node('Robot') { 
        sh '''
        cd /mnt/Docker/019.CC_Web
        REPOSITORY=hub.nercoa.com/case-center/web:${ImageTag}
        docker rm -f FZ_CaseCenter_Web || true
        docker container run -d \
        --volume /etc/localtime:/etc/localtime:ro \
        --volume `pwd`/Config:/app/Config \
        --restart always \
        --user root \
        --name FZ_CaseCenter_Web \
        -h FZ_CaseCenter_Web \
        -p 8015:80 \
        $REPOSITORY
        '''
  }
}
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

WinJayX

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值