Add Jenkinsfile

Add rudimentary jenkinsfile to run the linter and build the project when
we open a new CR.
Add multistage builds in jami-web Dockerfile

Change-Id: Ifa3bbe20f14f944ec30ca10aa1a42fca6b3c2940
diff --git a/Dockerfile b/Dockerfile
index 40d78d9..be62653 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,4 +1,4 @@
-FROM jami-daemon
+FROM jami-daemon AS jami-web
 
 WORKDIR /web-client
 ENV LD_LIBRARY_PATH=/daemon/src/.libs
@@ -20,7 +20,16 @@
 COPY tsconfig.json ./
 
 RUN npm ci
-
 COPY . .
 
+FROM jami-web AS development
 CMD ["npm", "start"]
+
+FROM jami-web AS test
+RUN npm run lint
+
+FROM jami-web AS build
+RUN npm run build
+
+FROM build AS production
+CMD ["npm", "run", "start:prod"]
diff --git a/Jenkinsfile b/Jenkinsfile
new file mode 100644
index 0000000..9cd6094
--- /dev/null
+++ b/Jenkinsfile
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2022 Savoir-faire Linux Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation; either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public
+ * License along with this program.  If not, see
+ * <https://www.gnu.org/licenses/>.
+ */
+
+// Requirements:
+// - gerrit-trigger plugin
+// - Docker plugin
+
+pipeline {
+    agent any
+    stages {
+        stage('Build jami-daemon') {
+            steps {
+                dir("daemon") {
+                    sh "docker build --build-arg config_args=\"--with-nodejs\" -t jami-daemon ."
+                }
+            }
+        }
+        stage('Lint & Test') {
+            steps {
+                script {
+                    docker.build("jami-web:${env.BUILD_ID}", "--target test .")
+                }
+            }
+        }
+        stage('Build') {
+            steps {
+                script {
+                    docker.build("jami-web:${env.BUILD_ID}", "--target build .")
+                }
+            }
+        }
+    }
+}
diff --git a/README.md b/README.md
index dd3cec9..34fd4fc 100644
--- a/README.md
+++ b/README.md
@@ -71,7 +71,7 @@
 ## 2. Build and run the web server and client
 
 ```bash
-docker build --tag jami-web .
+docker build --target development --tag jami-web .
 docker run -it \
   -p 3001:3001 \
   -p 3000:3000 \
diff --git a/docker-compose.yml b/docker-compose.yml
index 7aef7d9..affc5ee 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -3,7 +3,9 @@
 services:
   jami-web:
     image: jami-web
-    build: .
+    build:
+      context: .
+      target: development
     volumes:
       # Add bind mounts for hot-reload
       - ./client/src:/web-client/client/src