|
| 1 | +image: docker:latest |
| 2 | +services: |
| 3 | + - docker:dind |
| 4 | + |
| 5 | +stages: |
| 6 | + - sandbox-build |
| 7 | + - prod-build |
| 8 | + - docker-build |
| 9 | + - docker-build-release |
| 10 | + - deploy-sandbox |
| 11 | + - deploy-production |
| 12 | + - deploy-fallback |
| 13 | + |
| 14 | +variables: |
| 15 | + DOCKER_DRIVER: overlay2 |
| 16 | + DOCKER_TLS_CERTDIR: "" |
| 17 | + CI_REGISTRY_IMAGE: ebispot/gwas-curation-ui |
| 18 | + CURATION_UI_SERVICE_NAME: gwas-curation-ui |
| 19 | + |
| 20 | +sandbox-build: |
| 21 | + image: node:14.15.5 |
| 22 | + stage: sandbox-build |
| 23 | + script: |
| 24 | + - npm -v |
| 25 | + - node -v |
| 26 | + - rm -rf node_modules |
| 27 | + - npm install |
| 28 | + - CI=false npm run build -- --base-href=/gwas/curation/ --configuration sandbox |
| 29 | + artifacts: |
| 30 | + paths: |
| 31 | + - dist/gwas-curation-ui/* |
| 32 | + only: |
| 33 | + - develop |
| 34 | + |
| 35 | +prod-build: |
| 36 | + image: node:14.15.5 |
| 37 | + stage: prod-build |
| 38 | + script: |
| 39 | + - npm -v |
| 40 | + - node -v |
| 41 | + - rm -rf node_modules |
| 42 | + - npm install |
| 43 | + - CI=false npm run build -- --base-href=/gwas/curation/ |
| 44 | + artifacts: |
| 45 | + paths: |
| 46 | + - dist/gwas-curation-ui/* |
| 47 | + except: |
| 48 | + - tags |
| 49 | + - develop |
| 50 | + |
| 51 | +docker-build: |
| 52 | + stage: docker-build |
| 53 | + script: |
| 54 | + - echo "$DOCKER_HUB_PASSWORD" > dhpw.txt |
| 55 | + - docker login -u "${DOCKER_HUB_USER}" --password-stdin < dhpw.txt |
| 56 | + - docker build --force-rm=true -t $CURATION_UI_SERVICE_NAME:latest . |
| 57 | + - docker tag $CURATION_UI_SERVICE_NAME:latest $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA |
| 58 | + - docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA |
| 59 | + except: |
| 60 | + - tags |
| 61 | + |
| 62 | +docker-build-release: |
| 63 | + variables: |
| 64 | + GIT_STRATEGY: none |
| 65 | + stage: docker-build-release |
| 66 | + script: |
| 67 | + - echo "$DOCKER_HUB_PASSWORD" > dhpw.txt |
| 68 | + - docker login -u "${DOCKER_HUB_USER}" --password-stdin < dhpw.txt |
| 69 | + - docker pull $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA |
| 70 | + - docker tag $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA $CI_REGISTRY_IMAGE:latest |
| 71 | + - docker tag $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA $CI_REGISTRY_IMAGE:$CI_COMMIT_TAG |
| 72 | + - docker push $CI_REGISTRY_IMAGE:latest |
| 73 | + - docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_TAG |
| 74 | + only: |
| 75 | + - tags |
| 76 | + |
| 77 | +deploy-sandbox: |
| 78 | + image: dtzar/helm-kubectl:2.13.1 |
| 79 | + stage: deploy-sandbox |
| 80 | + script: |
| 81 | + - echo "Deploy to sandbox server" |
| 82 | + - mkdir -p /root/.kube |
| 83 | + - echo ${SANBOX_KUBECONF} | base64 -d > /root/.kube/config |
| 84 | + - helm init --stable-repo-url https://charts.helm.sh/stable |
| 85 | + - helm delete --purge gwas-curation-ui || true |
| 86 | + - helm install --name gwas-curation-ui --set k8Namespace=gwas,image.repository=$CI_REGISTRY_IMAGE,image.tag=$CI_COMMIT_SHA ./k8chart/ --wait |
| 87 | + environment: |
| 88 | + name: sandbox |
| 89 | + only: |
| 90 | + - develop |
| 91 | + |
| 92 | +deploy-fallback: |
| 93 | + image: dtzar/helm-kubectl:2.13.1 |
| 94 | + stage: deploy-fallback |
| 95 | + script: |
| 96 | + - echo "Deploy to Production fallback server" |
| 97 | + - mkdir -p /root/.kube |
| 98 | + - echo ${PFALLBACK_KUBECONFIG} | base64 -d > /root/.kube/config |
| 99 | + - helm init --stable-repo-url https://charts.helm.sh/stable |
| 100 | + - helm delete --purge gwas-curation-ui || true |
| 101 | + - helm install --name gwas-curation-ui --set k8Namespace=gwas,replicaCount=3,image.repository=$CI_REGISTRY_IMAGE,image.tag=$CI_COMMIT_TAG ./k8chart/ --wait |
| 102 | + environment: |
| 103 | + name: production |
| 104 | + only: |
| 105 | + - tags |
| 106 | + |
| 107 | +deploy-production: |
| 108 | + image: dtzar/helm-kubectl:2.13.1 |
| 109 | + stage: deploy-production |
| 110 | + script: |
| 111 | + - echo "Deploy to Production server" |
| 112 | + - mkdir -p /root/.kube |
| 113 | + - echo ${PLIVE_KUBECONFIG} | base64 -d > /root/.kube/config |
| 114 | + - helm init --stable-repo-url https://charts.helm.sh/stable |
| 115 | + - helm delete --purge gwas-curation-ui || true |
| 116 | + - helm install --name gwas-curation-ui --set k8Namespace=gwas,replicaCount=3,image.repository=$CI_REGISTRY_IMAGE,image.tag=$CI_COMMIT_TAG ./k8chart/ --wait |
| 117 | + environment: |
| 118 | + name: production |
| 119 | + only: |
| 120 | + - tags |
| 121 | + |
0 commit comments