diff --git a/Jenkinsfile_screen b/Jenkinsfile_screen new file mode 100644 index 0000000..c96a0c0 --- /dev/null +++ b/Jenkinsfile_screen @@ -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/GovernmentDataResourceCenter.git" + + stage('Run shell') { + git branch: 'master', credentialsId: 'gitea-builder', url: "${CODE_ADDR}" + + container('image-builder') { + sh''' + /kaniko/executor --context=${BUILD_WORKSPACE} --dockerfile=./super-screen/Dockerfile --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 diff --git a/api/Dockerfile b/api/Dockerfile index 10fc786..f651bda 100644 --- a/api/Dockerfile +++ b/api/Dockerfile @@ -1,16 +1,16 @@ FROM registry.cn-hangzhou.aliyuncs.com/fs-devops/node:12-dev as builder -COPY . /var/app +COPY ./api/ /var/app WORKDIR /var/app EXPOSE 8080 -RUN npm config set registry=http://10.8.30.22:7000 +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 http://10.8.30.22:7000 +RUN npm install --registry https://nexus.ngaiot.com/repository/fs-npm/ FROM registry.cn-hangzhou.aliyuncs.com/fs-devops/node:12 diff --git a/jenkinsfilenew_api b/jenkinsfilenew_api new file mode 100644 index 0000000..f2be615 --- /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/GovernmentDataResourceCenter.git" + + stage('Run shell') { + git branch: 'master', credentialsId: 'gitea-builder', url: "${CODE_ADDR}" + + container('image-builder') { + sh''' + /kaniko/executor --context=${BUILD_WORKSPACE} --dockerfile=./api/Dockerfile --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 diff --git a/jenkinsfilenew_web b/jenkinsfilenew_web new file mode 100644 index 0000000..bfc589f --- /dev/null +++ b/jenkinsfilenew_web @@ -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/GovernmentDataResourceCenter.git" + + stage('Run shell') { + git branch: 'master', credentialsId: 'gitea-builder', url: "${CODE_ADDR}" + + container('image-builder') { + sh''' + /kaniko/executor --context=${BUILD_WORKSPACE} --dockerfile=./web/Dockerfile --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 diff --git a/super-screen/Dockerfile b/super-screen/Dockerfile index 08dc512..e593610 100644 --- a/super-screen/Dockerfile +++ b/super-screen/Dockerfile @@ -1,6 +1,6 @@ FROM repository.anxinyun.cn/base-images/nodejs12:20.10.12.2 -COPY . /var/app +COPY ./super-screen /var/app WORKDIR /var/app @@ -8,12 +8,12 @@ EXPOSE 8080 RUN npm cache clean -f -RUN npm install --registry http://10.8.30.22:7000 --legacy-peer-deps +RUN npm install --registry https://nexus.ngaiot.com/repository/fs-npm/ --legacy-peer-deps 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 --registry https://nexus.ngaiot.com/repository/fs-npm/ #RUN npm cache clean -f && npm install --production --force --registry http://10.8.30.22:7000 CMD ["-u", "http://localhost:8088"] diff --git a/web/Dockerfile b/web/Dockerfile index 08dc512..ceacae2 100644 --- a/web/Dockerfile +++ b/web/Dockerfile @@ -8,12 +8,12 @@ EXPOSE 8080 RUN npm cache clean -f -RUN npm install --registry http://10.8.30.22:7000 --legacy-peer-deps +RUN npm install --registry https://nexus.ngaiot.com/repository/fs-npm/ --legacy-peer-deps 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 --registry https://nexus.ngaiot.com/repository/fs-npm/ #RUN npm cache clean -f && npm install --production --force --registry http://10.8.30.22:7000 CMD ["-u", "http://localhost:8088"]