peng.peng 1 year ago
parent
commit
8909b817ae
  1. 21
      Jenkinsfile_screen
  2. 6
      api/Dockerfile
  3. 21
      jenkinsfilenew_api
  4. 21
      jenkinsfilenew_web
  5. 6
      super-screen/Dockerfile
  6. 4
      web/Dockerfile

21
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}"
}
}
}

6
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

21
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}"
}
}
}

21
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}"
}
}
}

6
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"]

4
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"]

Loading…
Cancel
Save