Browse Source

docker

release_0.0.3
巴林闲侠 2 years ago
parent
commit
d0b6bfd574
  1. 19
      code/api/Dockerfile
  2. 19
      code/api/jenkinsfile
  3. 20
      code/web/Dockerfile
  4. 19
      code/web/jenkinsfile

19
code/api/Dockerfile

@ -1,7 +1,4 @@
FROM repository.anxinyun.cn/base-images/nodejs12:20.10.12.2
MAINTAINER liuxinyi "liu.xinyi@free-sun.com.cn"
FROM repository.anxinyun.cn/devops/node:12-dev as builder
COPY . /var/app
@ -9,6 +6,16 @@ WORKDIR /var/app
EXPOSE 8080
CMD ["-g", "postgres://FashionAdmin:123456@iota-m1:5433/SmartRiver", "--qnak", "5XrM4wEB9YU6RQwT64sPzzE6cYFKZgssdP5Kj3uu", "--qnsk", "w6j2ixR_i-aelc6I7S3HotKIX-ukMzcKmDfH6-M5", "--qnbkt", "anxinyun-test", "--qndmn", "http://test.resources.anxinyun.cn"]
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 rm -rf package-lock.json
RUN npm install --registry http://10.8.30.22:7000
FROM repository.anxinyun.cn/devops/node:12-dev
WORKDIR /app
COPY --from=builder /var/app .
ENTRYPOINT [ "node", "server.js" ]
CMD ["node", "server.js"]

19
code/api/jenkinsfile

@ -0,0 +1,19 @@
pipeline {
agent {
node{
label 'jnlp-slave'
}
}
stages {
stage('Testing iot_auth ......') {
steps {
sh 'switch-auth.sh iot_auth'
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} .'
sh 'docker push registry.cn-hangzhou.aliyuncs.com/${CLOUD}/${JOB_NAME}:${IMAGE_VERSION}'
}
}
}
}

20
code/web/Dockerfile

@ -1,5 +1,4 @@
FROM repository.anxinyun.cn/base-images/nodejs12:20.10.12.2
FROM repository.anxinyun.cn/devops/node:12-dev as builder
COPY . /var/app
@ -7,6 +6,19 @@ WORKDIR /var/app
EXPOSE 8080
CMD ["-u", "http://localhost:8088"]
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 repository.anxinyun.cn/devops/node:12-dev
WORKDIR /app
COPY --from=builder /var/app .
ENTRYPOINT [ "node", "server.js" ]
CMD ["node", "server.js"]

19
code/web/jenkinsfile

@ -0,0 +1,19 @@
pipeline {
agent {
node{
label 'jnlp-slave'
}
}
stages {
stage('Testing iot_auth ......') {
steps {
sh 'switch-auth.sh iot_auth'
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} .'
sh 'docker push registry.cn-hangzhou.aliyuncs.com/${CLOUD}/${JOB_NAME}:${IMAGE_VERSION}'
}
}
}
}
Loading…
Cancel
Save