From a146a8d11ac2a68833ab40448656c1fe1da4544c Mon Sep 17 00:00:00 2001
From: CANLERS Julien <julien.canlers8@etu.univ-lorraine.fr>
Date: Thu, 18 Feb 2021 10:27:56 +0000
Subject: [PATCH] Add new file

---
 debian:stretch/Jenkinsfile | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)
 create mode 100644 debian:stretch/Jenkinsfile

diff --git a/debian:stretch/Jenkinsfile b/debian:stretch/Jenkinsfile
new file mode 100644
index 0000000..2fbd41c
--- /dev/null
+++ b/debian:stretch/Jenkinsfile
@@ -0,0 +1,30 @@
+node {
+  def app1
+
+  stage('Cleaning up working dir') {
+    step([$class: 'WsCleanup'])
+  }
+
+  stage('Clone repository') {
+    /* Let's make sure we have the repository cloned to our workspace */
+    checkout scm
+  }
+
+  stage('build') {
+    stage('Build image application:latest') {
+      /* This builds the actual image; synonymous to
+      * docker build on the command line */
+      app1 = docker.build( "http://localhost:8081/repository/docker-private/debian:1")
+    }
+  }
+
+  stage('Push image') {
+    /* Finally, we'll push the image with two tags:
+    * First, the incremental build number from Jenkins
+    * Second, the 'latest' tag.
+    * Pushing multiple tags is cheap, as all the layers are reused. */
+    docker.withRegistry('http://localhost:8081/repository/docker-private/', 'nexus-user-credentials') {
+      app1.push("latest")
+    }
+  }
+}
\ No newline at end of file
-- 
GitLab