Bladeren bron

Revert "remove jenkins and .env"

This reverts commit e44828db4462ecc911ea520207443729ced7851d.
yazid138 3 jaren geleden
bovenliggende
commit
fd5f0a9ee5
2 gewijzigde bestanden met toevoegingen van 98 en 0 verwijderingen
  1. 11 0
      .env
  2. 87 0
      Jenkinsfile

+ 11 - 0
.env

@@ -0,0 +1,11 @@
+BASE_URL=https://api.sidali.sixsenz.net
+PORT=5000
+SECRET=3d3eb3d842f4e595048f1806ca815f8092e29fb6b98a30dff0b8241ad0e6c273
+
+MONGO_URL=mongodb://production.sidali.sixsenz.net:50010/ptb-db
+TOKEN_DEVELOPMENT=77aecfec-10ac-3b4f-ab59-3fbfbeed6324
+TOKEN_PRODUCTION=5b62f743-eef2-3370-8c66-6951b2e9c2c5
+TOKEN_AUTO=5j12h43g6hj2367234k57
+
+
+ENV=production

+ 87 - 0
Jenkinsfile

@@ -0,0 +1,87 @@
+/*
+  1. added 
+     client_max_body_size 0;
+     to avoid 413 error
+*/
+
+node {
+  def app
+  def registryAddress
+  def registryCredential
+  try {
+    // environment {
+      registryAddress = "https://registry.sidali.sixsenz.net"
+      registryCredential = 'DockerRegistry-ID'
+    // }
+	
+    stage('Checkout') {
+      checkout scm
+    }
+	
+    stage('Initialize'){
+      def dockerHome = tool 'myDocker'
+      env.PATH = "${dockerHome}/bin:${env.PATH}"
+    }
+	
+    stage('Environment') {
+      sh 'git --version'
+      echo "Branch: master"
+      sh 'docker -v'
+      sh 'printenv'
+    }
+	
+    stage('Test Build'){
+     sh 'docker build -t ptb-be -f dockerfile .'
+    }
+	
+    stage('Build Deploy '){
+            // // now you are on slave labeled with 'label'
+            // def workspace = WORKSPACE
+            // // ${workspace} will now contain an absolute path to job workspace on slave
+
+            // workspace = env.WORKSPACE
+            // // ${workspace} will still contain an absolute path to job workspace on slave
+
+            // // When using a GString at least later Jenkins versions could only handle the env.WORKSPACE variant:
+            // echo "Current workspace is ${env.WORKSPACE}"
+
+            // // the current Jenkins instances will support the short syntax, too:
+            // echo "Current workspace is $WORKSPACE"
+        docker.withTool("myDocker"){
+            docker.withRegistry(registryAddress, registryCredential) {
+
+                def dockerImage = docker.build("ptb-be:${env.BUILD_ID}")
+
+                /* Push the container to the custom Registry */
+                dockerImage.push()
+                dockerImage.push('latest')
+            }
+        }
+        // echo 'env.BRANCH_NAME : ' + env.BRANCH_NAME
+        // if(env.BRANCH_NAME == 'master'){
+        //     script {
+        //         app = docker.build("ptb-be:latest")
+        //         echo 'app content : ' + app
+        //         dockerImage = registryAddress + ":$BUILD_NUMBER"
+        //         echo 'dockerImage : ' + dockerImage
+        //         echo 'registryCredential : ' + registryCredential
+        //         echo 'registryAddress : ' + registryAddress
+        //         echo 'withRegistry running...'
+        //         docker.withRegistry( "http://"+registryAddress, registryCredential ) {
+        //             echo 'withRegistry inside... app.push start'
+        //             //app.push("${BUILD_NUMBER}")
+        //             app.push('ptb-be:latest')
+        //             echo 'app.push done'
+        //             echo 'withRegistry inside... app.push latest start'
+        //             app.push(latest)
+        //             echo 'withRegistry inside... app.push latest done'
+        //         }
+        //     }
+        // }
+
+     }
+  }
+  catch (err) {
+    throw err
+  }
+}