From ad0af2fd5485fb4b791c678f96ee1e484b0764e1 Mon Sep 17 00:00:00 2001 From: iris_cx Date: Tue, 18 Jul 2023 07:58:51 +0000 Subject: [PATCH 1/6] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=20'web/Dockerfilenew'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/Dockerfilenew | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 web/Dockerfilenew diff --git a/web/Dockerfilenew b/web/Dockerfilenew new file mode 100644 index 0000000..c3597fa --- /dev/null +++ b/web/Dockerfilenew @@ -0,0 +1,31 @@ +FROM registry.cn-hangzhou.aliyuncs.com/fs-devops/node:12-dev as builder + +COPY ./web/ /var/app + +WORKDIR /var/app + +EXPOSE 8080 + +RUN npm config set registry=https://nexus.ngaiot.com/repository/fs-npm/ + +RUN echo "{\"time\":\"$BUILD_TIMESTAMP\",\"build\": \"$BUILD_NUMBER\",\"revision\": \"$SVN_REVISION_1\",\"URL\":\"$SVN_URL_1\"}" > version.json + +RUN npm cache clean -f +RUN rm -rf package-lock.json +RUN npm install --registry https://nexus.ngaiot.com/repository/fs-npm/ + +RUN npm run build + +RUN rm -rf client/src + +RUN rm -rf node_modules + +RUN npm install --production --registry https://nexus.ngaiot.com/repository/fs-npm/ + +FROM registry.cn-hangzhou.aliyuncs.com/fs-devops/node:12 + +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 a826a0bade8b3852b41aec42b53bddfeb7297e38 Mon Sep 17 00:00:00 2001 From: iris_cx Date: Tue, 18 Jul 2023 07:59:29 +0000 Subject: [PATCH 2/6] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=20'api/Dockerfilenew'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/Dockerfilenew | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 api/Dockerfilenew diff --git a/api/Dockerfilenew b/api/Dockerfilenew new file mode 100644 index 0000000..529db16 --- /dev/null +++ b/api/Dockerfilenew @@ -0,0 +1,14 @@ +FROM registry.cn-hangzhou.aliyuncs.com/fs-devops/node:12-dev as builder +COPY ./api/ /var/app +WORKDIR /var/app +EXPOSE 8080 +RUN npm config set registry=https://nexus.ngaiot.com/repository/fs-npm/ +RUN echo "{\"time\":\"$BUILD_TIMESTAMP\",\"build\": \"$BUILD_NUMBER\",\"revision\": \"$SVN_REVISION_1\",\"URL\":\"$SVN_URL_1\"}" > version.json +RUN npm cache clean -f +RUN rm -rf package-lock.json +RUN npm install --registry https://nexus.ngaiot.com/repository/fs-npm/ + +FROM registry.cn-hangzhou.aliyuncs.com/fs-devops/node:12 +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 af286831c048d3c43653204b4392b66cc1d62d88 Mon Sep 17 00:00:00 2001 From: iris_cx Date: Tue, 18 Jul 2023 08:01:20 +0000 Subject: [PATCH 3/6] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=20'jenkinsfilenew=5Fapi'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- jenkinsfilenew_api | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 jenkinsfilenew_api diff --git a/jenkinsfilenew_api b/jenkinsfilenew_api new file mode 100644 index 0000000..7f84e38 --- /dev/null +++ b/jenkinsfilenew_api @@ -0,0 +1,21 @@ +podTemplate { + node('pod-templ-jenkins-slave-common') { + + env.IMAGE_NAME = "${IOT_IMAGES_REGISTRY}/${SMARTCITY}/${JOB_NAME}" + env.IMAGE_NAME_SHORT = "${SMARTCITY}/${JOB_NAME}" + env.CODE_ADDR = "${GIT_ADDRESS}/free-sun/PumpStation.git" + + stage('Run shell') { + git branch: 'dev', credentialsId: 'gitea-builder', url: "${CODE_ADDR}" + + container('image-builder') { + sh''' + /kaniko/executor --context=${BUILD_WORKSPACE} --dockerfile=./api/Dockerfilenew --destination=${IMAGE_NAME}:${IMAGE_VERSION} --cache=false --cleanup + ''' + } + + buildName "${IMAGE_NAME_SHORT}:${IMAGE_VERSION}" + buildDescription "${IMAGE_NAME}:${IMAGE_VERSION}" + } + } +} \ No newline at end of file From 5648e6e97a1d41430485425766a0f47018a272cb Mon Sep 17 00:00:00 2001 From: iris_cx Date: Tue, 18 Jul 2023 08:05:10 +0000 Subject: [PATCH 4/6] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=20'jenkinsfilenew=5Fweb'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- jenkinsfilenew_web | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 jenkinsfilenew_web diff --git a/jenkinsfilenew_web b/jenkinsfilenew_web new file mode 100644 index 0000000..3e61503 --- /dev/null +++ b/jenkinsfilenew_web @@ -0,0 +1,25 @@ +podTemplate { + node('pod-templ-jenkins-slave-common') { + + env.IMAGE_NAME = "${IOT_IMAGES_REGISTRY}/${SMARTCITY}/${JOB_NAME}" + env.IMAGE_NAME_SHORT = "${SMARTCITY}/${JOB_NAME}" + env.CODE_ADDR = "${GIT_ADDRESS}/free-sun/PumpStation.git" + + stage('Run shell') { + git branch: 'dev', credentialsId: 'gitea-builder', url: "${CODE_ADDR}" + + container('image-builder') { + sh''' + pwd + ls -al + + /kaniko/executor --context=${BUILD_WORKSPACE} --dockerfile=./web/Dockerfilenew --destination=${IMAGE_NAME}:${IMAGE_VERSION} --cache=false --cleanup + + ''' + } + + buildName "${IMAGE_NAME_SHORT}:${IMAGE_VERSION}" + buildDescription "${IMAGE_NAME}:${IMAGE_VERSION}" + } + } +} \ No newline at end of file From 935a61d77d1b1d556312c076d9b93d1a5dfecd9c Mon Sep 17 00:00:00 2001 From: iris_cx Date: Tue, 18 Jul 2023 08:09:58 +0000 Subject: [PATCH 5/6] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20'jenkinsfilenew=5Fapi'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- jenkinsfilenew_api | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jenkinsfilenew_api b/jenkinsfilenew_api index 7f84e38..a66ea9b 100644 --- a/jenkinsfilenew_api +++ b/jenkinsfilenew_api @@ -6,7 +6,7 @@ podTemplate { env.CODE_ADDR = "${GIT_ADDRESS}/free-sun/PumpStation.git" stage('Run shell') { - git branch: 'dev', credentialsId: 'gitea-builder', url: "${CODE_ADDR}" + git branch: 'master', credentialsId: 'gitea-builder', url: "${CODE_ADDR}" container('image-builder') { sh''' From 3d8ef63fc4f46615de1dfa979df8aeb974612077 Mon Sep 17 00:00:00 2001 From: iris_cx Date: Tue, 18 Jul 2023 08:10:12 +0000 Subject: [PATCH 6/6] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20'jenkinsfilenew=5Fweb'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- jenkinsfilenew_web | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jenkinsfilenew_web b/jenkinsfilenew_web index 3e61503..6bedb3a 100644 --- a/jenkinsfilenew_web +++ b/jenkinsfilenew_web @@ -6,7 +6,7 @@ podTemplate { env.CODE_ADDR = "${GIT_ADDRESS}/free-sun/PumpStation.git" stage('Run shell') { - git branch: 'dev', credentialsId: 'gitea-builder', url: "${CODE_ADDR}" + git branch: 'master', credentialsId: 'gitea-builder', url: "${CODE_ADDR}" container('image-builder') { sh'''