From feeaf5d683c1787b317e1fa3c63afecff9f11f6b Mon Sep 17 00:00:00 2001
From: Hugo SUBTIL <ext.sopra.husubtil@grandlyon.com>
Date: Wed, 16 Dec 2020 16:59:23 +0100
Subject: [PATCH 1/4] fix: build

---
 Dockerfile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Dockerfile b/Dockerfile
index 83be11124..bee682a15 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -20,7 +20,7 @@ COPY /src ./src
 ARG conf
 
 # Building the Angular app /dist i18n
-RUN npm run build:dev
+RUN npm run build:prod
 
 # Stage 1, based on Nginx, to have only the compiled app
 FROM nginx
-- 
GitLab


From a7b9a77dd8fa88c157a9b6c959a0538d2509095e Mon Sep 17 00:00:00 2001
From: Hugo SUBTIL <ext.sopra.husubtil@grandlyon.com>
Date: Wed, 16 Dec 2020 17:00:32 +0100
Subject: [PATCH 2/4] fix: cicd

---
 .gitlab-ci.yml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 5a243713c..9cc64610d 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -27,7 +27,7 @@ build_dev:
     - docker:18.09-dind
   stage: build
   only:
-    - dev
+    - test
   script:
     - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
     - docker build --pull -t "$CI_REGISTRY_IMAGE:dev" --build-arg conf=dev .
@@ -63,7 +63,7 @@ deploy_dev:
   tags:
     - deploy
   only:
-    - dev
+    - test
   script:
     - cd /home/mps/ram
     - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
-- 
GitLab


From e15a0f9c2c80167ca3bb67cf14f53441398238fc Mon Sep 17 00:00:00 2001
From: Hugo SUBTIL <ext.sopra.husubtil@grandlyon.com>
Date: Wed, 16 Dec 2020 17:17:28 +0100
Subject: [PATCH 3/4] fix: build

---
 angular.json   | 11 +++++++++--
 src/index.html |  2 +-
 2 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/angular.json b/angular.json
index 6e95360f6..962c5cd18 100644
--- a/angular.json
+++ b/angular.json
@@ -14,9 +14,15 @@
       "sourceRoot": "src",
       "prefix": "app",
       "i18n": {
-        "sourceLocale": "fr",
+        "sourceLocale": {
+          "code": "fr",
+          "baseHref": ""
+        },
         "locales": {
-          "en": "src/locale/messages.en.xlf"
+          "en": {
+            "baseHref": "/en/",
+            "translation": "src/locale/messages.en.xlf"
+          }
         }
       },
       "architect": {
@@ -54,6 +60,7 @@
                   "with": "src/environments/environment.prod.ts"
                 }
               ],
+              "aot": true,
               "optimization": true,
               "outputHashing": "all",
               "sourceMap": false,
diff --git a/src/index.html b/src/index.html
index 9e350807c..034e83f36 100644
--- a/src/index.html
+++ b/src/index.html
@@ -1,5 +1,5 @@
 <!DOCTYPE html>
-<html lang="en">
+<html lang="fr">
   <head>
     <meta charset="utf-8" />
     <title>Réseau des Acteurs de la Médiation</title>
-- 
GitLab


From 599a9960596c8c2c25cdad9b06e04077197b8b58 Mon Sep 17 00:00:00 2001
From: Hugo SUBTIL <ext.sopra.husubtil@grandlyon.com>
Date: Wed, 16 Dec 2020 17:29:05 +0100
Subject: [PATCH 4/4] fix: build

---
 .gitlab-ci.yml |  4 ++--
 nginx/dev.conf | 18 ++++++------------
 2 files changed, 8 insertions(+), 14 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 9cc64610d..5a243713c 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -27,7 +27,7 @@ build_dev:
     - docker:18.09-dind
   stage: build
   only:
-    - test
+    - dev
   script:
     - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
     - docker build --pull -t "$CI_REGISTRY_IMAGE:dev" --build-arg conf=dev .
@@ -63,7 +63,7 @@ deploy_dev:
   tags:
     - deploy
   only:
-    - test
+    - dev
   script:
     - cd /home/mps/ram
     - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
diff --git a/nginx/dev.conf b/nginx/dev.conf
index 4265eb65e..9496c647f 100644
--- a/nginx/dev.conf
+++ b/nginx/dev.conf
@@ -1,24 +1,17 @@
-upstream api_node_js {
-	server	service-ram:3000;
-}
-
 server {
   listen 8080 default_server;
 
-  root /usr/share/nginx/html;
-  index index.html;
+  root /usr/share/nginx/html/;
 
   location / {
     # First attempt to serve request as file, then
     # as directory, then fall back to displaying a 404.
-    try_files $uri $uri/ $uri/index.html @backend;
+    try_files $uri $uri/ /index.html;
   }
 
-  location @backend {
-    rewrite /api/?(.*) /$1 break;
-    proxy_pass http://api_node_js;
-    proxy_set_header   X-Forwarded-Proto $scheme;
-    proxy_set_header   X-Real-IP         $remote_addr;
+    location /api {
+        rewrite ^/api/(.*) /$1 break;
+        proxy_pass http://service-ram:3000/api;
   }
 
   location /base-adresse/base-adresse-nationale/streets {
@@ -38,6 +31,7 @@ server {
     proxy_pass https://download.data.grandlyon.com/wfs/grandlyon;
   }
 
+
   # REALLY important for JavaScript modules (type="module") to work as expected!!!
   location ~ \.js {
     add_header  Content-Type   text/javascript;
-- 
GitLab