From f7bd1151c4a442a2db49681abdda73b492fa2961 Mon Sep 17 00:00:00 2001 From: zhouxin Date: Fri, 9 Dec 2022 20:34:49 +0800 Subject: [PATCH 1/4] jenkinsfile --- jenkinsfile_poms_web | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/jenkinsfile_poms_web b/jenkinsfile_poms_web index cf1543b..d292fba 100644 --- a/jenkinsfile_poms_web +++ b/jenkinsfile_poms_web @@ -6,13 +6,12 @@ pipeline { } stages { - stage('Testing pep-report-web ......') { + stage('Testing datacenter-web ......') { steps { - sh 'switch-auth.sh anxinyun' - buildName "#${BUILD_NUMBER} ~/fs-cloud/${JOB_NAME}:${IMAGE_VERSION}" - buildDescription "registry.cn-hangzhou.aliyuncs.com/${CLOUD}/${JOB_NAME}:${IMAGE_VERSION}" - sh 'docker build -t registry.cn-hangzhou.aliyuncs.com/${CLOUD}/${JOB_NAME}:${IMAGE_VERSION} ./web' - sh 'docker push registry.cn-hangzhou.aliyuncs.com/${CLOUD}/${JOB_NAME}:${IMAGE_VERSION}' + buildName "#${BUILD_NUMBER} ~/pep/${JOB_NAME}:${IMAGE_VERSION}" + buildDescription "harbor.anxinyun.cn/pep/${JOB_NAME}:${IMAGE_VERSION}" + sh 'docker build -t harbor.anxinyun.cn/pep/${JOB_NAME}:${IMAGE_VERSION} ./web' + sh 'docker push harbor.anxinyun.cn/pep/${JOB_NAME}:${IMAGE_VERSION}' } } } From 986501429962fcbe23fdd2defd34268e06507570 Mon Sep 17 00:00:00 2001 From: zhouxin Date: Fri, 9 Dec 2022 20:36:02 +0800 Subject: [PATCH 2/4] web-dockerfile --- web/Dockerfile | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/web/Dockerfile b/web/Dockerfile index 3991885..02fe3db 100644 --- a/web/Dockerfile +++ b/web/Dockerfile @@ -27,14 +27,19 @@ # 旧版本构建方式 -FROM repository.anxinyun.cn/base-images/nodejs12:20.10.12.2 - +FROM registry.cn-hangzhou.aliyuncs.com/fs-devops/node:12-dev as builder COPY . /var/app - WORKDIR /var/app - EXPOSE 8080 - -CMD ["-u", "http://localhost:8088"] - -ENTRYPOINT [ "node", "server.js" ] \ No newline at end of file +RUN npm config set registry=http://10.8.30.22:7000 +RUN echo "{\"time\":\"$BUILD_TIMESTAMP\",\"build\": \"$BUILD_NUMBER\",\"revision\": \"$SVN_REVISION_1\",\"URL\":\"$SVN_URL_1\"}" > version.json +RUN npm cache clean -f +RUN npm install --registry http://10.8.30.22:7000 +RUN npm run build +RUN rm -rf client/src +RUN rm -rf node_modules +RUN npm install --production --registry http://10.8.30.22:7000 +FROM registry.cn-hangzhou.aliyuncs.com/fs-devops/node-16:7.22-06-20 +COPY --from=builder --chown=node /var/app /home/node/app +WORKDIR /home/node/app +CMD ["node", "server.js"] \ No newline at end of file From 800acefbc244489bea08310fded22d6224f6d4a6 Mon Sep 17 00:00:00 2001 From: zhouxin Date: Fri, 9 Dec 2022 20:39:45 +0800 Subject: [PATCH 3/4] force --- web/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/Dockerfile b/web/Dockerfile index 02fe3db..a9a3af6 100644 --- a/web/Dockerfile +++ b/web/Dockerfile @@ -38,7 +38,7 @@ RUN npm install --registry http://10.8.30.22:7000 RUN npm run build RUN rm -rf client/src RUN rm -rf node_modules -RUN npm install --production --registry http://10.8.30.22:7000 +RUN npm install --production --force --registry http://10.8.30.22:7000 FROM registry.cn-hangzhou.aliyuncs.com/fs-devops/node-16:7.22-06-20 COPY --from=builder --chown=node /var/app /home/node/app WORKDIR /home/node/app From 309b975ba13862084ac42eae3c07bbdaa5a78b23 Mon Sep 17 00:00:00 2001 From: zhouxin Date: Fri, 9 Dec 2022 20:42:12 +0800 Subject: [PATCH 4/4] nerdctl --- jenkinsfile_poms_web | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/jenkinsfile_poms_web b/jenkinsfile_poms_web index d292fba..b74c3b9 100644 --- a/jenkinsfile_poms_web +++ b/jenkinsfile_poms_web @@ -10,8 +10,8 @@ pipeline { steps { buildName "#${BUILD_NUMBER} ~/pep/${JOB_NAME}:${IMAGE_VERSION}" buildDescription "harbor.anxinyun.cn/pep/${JOB_NAME}:${IMAGE_VERSION}" - sh 'docker build -t harbor.anxinyun.cn/pep/${JOB_NAME}:${IMAGE_VERSION} ./web' - sh 'docker push harbor.anxinyun.cn/pep/${JOB_NAME}:${IMAGE_VERSION}' + sh 'nerdctl build -t harbor.anxinyun.cn/pep/${JOB_NAME}:${IMAGE_VERSION} ./web' + sh 'nerdctl push harbor.anxinyun.cn/pep/${JOB_NAME}:${IMAGE_VERSION}' } } }