|
|
@@ -1,48 +0,0 @@
|
|
|
-node {
|
|
|
- // Git checkout before load source the file
|
|
|
- checkout scm
|
|
|
- // sh '''
|
|
|
- // ls -lhrt
|
|
|
- // '''
|
|
|
- def base_branch = ref.tokenize('/')[2]
|
|
|
- def rootDir = pwd()
|
|
|
- def yaml2Map = load "./sharedLibs/yaml2Map.groovy"
|
|
|
- def stages = load "./sharedLibs/stages.nodejs.groovy"
|
|
|
- def GLOBAL_CONFIG = yaml2Map.read('global.yaml').project
|
|
|
-
|
|
|
- dir("AuctionApp/DEV/H5-App") {
|
|
|
- def PROJECT_CONFIG = yaml2Map.read('cfg.yaml').project
|
|
|
- def CONFIG = yaml2Map.merge(PROJECT_CONFIG, GLOBAL_CONFIG)
|
|
|
- CONFIG.docker.image = String.format(CONFIG.docker.image, CONFIG.service.name)
|
|
|
- println 'configs: ' + CONFIG
|
|
|
-
|
|
|
- //生成Dockerfile
|
|
|
- def generateDockerfile = {->
|
|
|
-
|
|
|
- pathOfDockerfile = 'projdir'
|
|
|
- def module = CONFIG.service.module == null ? '' : (CONFIG.service.module[-1] == '/' ? CONFIG.service.module : CONFIG.service.module + '/')
|
|
|
- echo "-----> Generating Dockerfile: ${pathOfDockerfile}/Dockerfile ..."
|
|
|
- sh """cat > ${pathOfDockerfile}/Dockerfile<<EOF
|
|
|
-FROM node:14-slim as BUILD
|
|
|
-LABEL stage=STATICRES-BUILD
|
|
|
-
|
|
|
-COPY ./ /proj
|
|
|
-WORKDIR /proj
|
|
|
-RUN npm config set registry https://registry.npm.taobao.org && npm install && npm run build
|
|
|
-
|
|
|
-FROM nginx:1.23-alpine as FINAL
|
|
|
-
|
|
|
-# configs for auction-dev.hobbystocks.cn
|
|
|
-COPY ./dockerfiles/auction-h5.conf /etc/nginx/conf.d/default.conf
|
|
|
-COPY ./other /usr/share/nginx
|
|
|
-COPY --from=BUILD /proj/dist /usr/share/nginx/auction
|
|
|
-EOF
|
|
|
-"""
|
|
|
- return pathOfDockerfile
|
|
|
- }
|
|
|
-
|
|
|
- stages.execute(CONFIG, base_branch, [
|
|
|
- 'GENERATEDOCKERFILE': generateDockerfile
|
|
|
- ])
|
|
|
- }
|
|
|
-}
|