Skip to content
Snippets Groups Projects
meteor-kubernetes.yml 1.81 KiB
Newer Older
  • Learn to ignore specific revisions
  • Marco's avatar
    Marco committed
    include: 
      - project: gitlab-ci/kubernetes-base
        ref: v1.0.0
        file: panter-kubernetes-base.yml
    
    image: panterch/docker-ci-meteor:latest
    
    
    variables:
      CHART_NAME: panter-charts/manulstack
      MONGODB_ENABLED: 'false'
      WORKER_ENABLED: 'false' # whether to create a custom worker
      MONGODB_BACKUP_ENABLED: 'true'
      MONGODB_REPLICAS: '3' # nubmer of mongodb replicas (default for prod)
    
      helmArgs: |
        --set mongodb.enabled=$MONGODB_ENABLED
        --set mongodb.backup.enabled=$MONGODB_BACKUP_ENABLED
        --set mongodb-replicaset.replicas=$MONGODB_REPLICAS
        --set mongodb-replicaset.fullnameOverride=$KUBE_APP_NAME-mongodb-replicaset
        --set worker.enabled=$WORKER_ENABLED
    
    app-build:
      extends: .app-build
      script:
        - cd $APP_PATH
        - echo "add healthcheck package"
        - meteor add panter:healthroute --allow-superuser
        - meteor add qualia:prod-shell --allow-superuser
        - echo "current path is $(pwd)"
        - yarn
        - echo "building into $CI_PROJECT_DIR"
        - TOOL_NODE_FLAGS="--max_old_space_size=4096 --min_semi_space_size=8 --max_semi_space_size=256" meteor build $CI_PROJECT_DIR --architecture os.linux.x86_64 --allow-superuser --server-only --directory
      artifacts:
        paths:
          - $CI_PROJECT_DIR/bundle
    
    
    
    .ensureDocker: &ensureDocker |
      function ensureDockerfile() {
        # this is for meteor
          
        if [ ! -f Dockerfile ]; then
          echo "Creating Dockerfile"
          NODE_VERSION_FULL=$(cat bundle/.node_version.txt)
          NODE_VERSION=${NODE_VERSION_FULL/v} # remove v
          
          cat > Dockerfile <<EOF
      FROM node:$NODE_VERSION
      ADD . /src
      RUN cd /src && rm -rf node_modules
      RUN cd /src/bundle/programs/server && npm install
    
      WORKDIR /src/bundle
      EXPOSE 8888
      CMD ["node", "main.js"]
      EOF
    
        fi
    
      }
    
    docker-build: 
      extends: .docker-build
      before_script: 
        - *ensureDocker
        - ensureDockerfile