侧边栏壁纸
博主头像
WinJay博主等级

博观而约取 厚积而薄发

  • 累计撰写 319 篇文章
  • 累计创建 169 个标签
  • 累计收到 1 条评论
隐藏侧边栏

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

WinJay
2021-07-13 / 0 评论 / 0 点赞 / 121 阅读 / 4,773 字 / 正在检测是否收录...
温馨提示:
本文最后更新于 2021-12-16,若内容或图片失效,请留言反馈。部分素材来自网络,若不小心影响到您的利益,请联系我们删除。
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

评论区