diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 3d6fd328531f768cb422a503cb059c3ce09fbdf5..7fa9ed4fed735cea3d16735656c432c45d2404db 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -2,20 +2,41 @@ stages: - build - deploy -build: +build_development: stage: build only: - master script: - - docker-compose --project-name admin-gui build + - export NODE_ENV=DEV + - docker-compose --project-name admin-gui-dev --build-arg env=dev admin-gui build -deploy: +deploy_development: stage: deploy only: - master script: - - docker-compose --project-name admin-gui up -d + - export NODE_ENV=DEV + - docker-compose --project-name admin-gui-dev up -d environment: name: development - url: https://data-reloaded-dev.alpha.grandlyon.com + # url: +build_staging: + stage: build + only: + - staging + script: + - export NODE_ENV=REC + - sed -i 's/DEV_/REC_/g' docker-compose.yml + - docker-compose --project-name admin-gui-rec --build-arg env=rec admin-gui build + +deploy_staging: + stage: deploy + only: + - staging + script: + - export NODE_ENV=REC + - sed -i 's/DEV_/REC_/g' docker-compose.yml + - docker-compose --project-name admin-gui-rec up -d + environment: + name: staging diff --git a/Dockerfile b/Dockerfile index f4060356cb35c3e97c34516d379fc5071db32901..0c891077e3f0f7aa88cc4447bf6af85494f5fbe3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,8 +9,10 @@ RUN npm install # Copy the project COPY . /app +ARG env + # Building the Angular app /dist -RUN npm run build:production +RUN npm run build:${env} # Stage 1, based on Nginx, to have only the compiled app FROM nginx diff --git a/angular.json b/angular.json index 17f09f04360658467c14639a6834e4ce5b8bc069..800080d97c50b35cedf6019f3e05ad9db95a6343 100644 --- a/angular.json +++ b/angular.json @@ -28,11 +28,11 @@ "scripts": [] }, "configurations": { - "production": { + "development": { "fileReplacements": [ { "replace": "src/environments/environment.ts", - "with": "src/environments/environment.prod.ts" + "with": "src/environments/environment.dev.ts" } ], "optimization": true, @@ -45,7 +45,25 @@ "vendorChunk": false, "buildOptimizer": true } + }, + "recette": { + "fileReplacements": [ + { + "replace": "src/environments/environment.ts", + "with": "src/environments/environment.rec.ts" + } + ], + "optimization": true, + "outputHashing": "all", + "sourceMap": false, + "extractCss": true, + "namedChunks": false, + "aot": true, + "extractLicenses": true, + "vendorChunk": false, + "buildOptimizer": true } + } }, "serve": { "builder": "@angular-devkit/build-angular:dev-server", diff --git a/docker-compose.yml b/docker-compose.yml index 784a03b01a0a22d3bd91a3eadabbe378ef7df7cc..117572fb6ec84c11472aeaf3df639d3bbed143eb 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -2,11 +2,11 @@ version: "2" services: admin-gui: - container_name: admin-gui + container_name: admin-gui-${NODE_ENV} build: context: ./ volumes: - ./nginx.conf.template:/etc/nginx/conf.d/default.conf ports: - - 8083:80 + - ${DEV_APP_PORT}:80 \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 6cbeb72568a9ada8752a57d94ef2089ee9ab8d74..7d22ca5fa507c074618313abdf195b5d7232b4d6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3766,12 +3766,14 @@ "balanced-match": { "version": "1.0.0", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "brace-expansion": { "version": "1.1.11", "bundled": true, "dev": true, + "optional": true, "requires": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -3786,17 +3788,20 @@ "code-point-at": { "version": "1.1.0", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "concat-map": { "version": "0.0.1", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "console-control-strings": { "version": "1.1.0", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "core-util-is": { "version": "1.0.2", @@ -3913,7 +3918,8 @@ "inherits": { "version": "2.0.3", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "ini": { "version": "1.3.5", @@ -3925,6 +3931,7 @@ "version": "1.0.0", "bundled": true, "dev": true, + "optional": true, "requires": { "number-is-nan": "^1.0.0" } @@ -3939,6 +3946,7 @@ "version": "3.0.4", "bundled": true, "dev": true, + "optional": true, "requires": { "brace-expansion": "^1.1.7" } @@ -3946,12 +3954,14 @@ "minimist": { "version": "0.0.8", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "minipass": { "version": "2.2.4", "bundled": true, "dev": true, + "optional": true, "requires": { "safe-buffer": "^5.1.1", "yallist": "^3.0.0" @@ -3970,6 +3980,7 @@ "version": "0.5.1", "bundled": true, "dev": true, + "optional": true, "requires": { "minimist": "0.0.8" } @@ -4050,7 +4061,8 @@ "number-is-nan": { "version": "1.0.1", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "object-assign": { "version": "4.1.1", @@ -4062,6 +4074,7 @@ "version": "1.4.0", "bundled": true, "dev": true, + "optional": true, "requires": { "wrappy": "1" } @@ -4183,6 +4196,7 @@ "version": "1.0.2", "bundled": true, "dev": true, + "optional": true, "requires": { "code-point-at": "^1.0.0", "is-fullwidth-code-point": "^1.0.0", diff --git a/package.json b/package.json index 83f31d428fc24825e5eacc7e2a90b797b9e16198..fe4294795669957c1f51e1bfbced3c22e95712f1 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,8 @@ "ng": "ng", "start": "ng serve", "build": "ng build", - "build:production": "ng build --prod --configuration=production", + "build:dev": "ng build --prod --configuration=development", + "build:rec": "ng build --prod --configuration=recette", "test": "ng test", "lint": "ng lint", "e2e": "ng e2e" diff --git a/src/app/app.component.ts b/src/app/app.component.ts index bbe53bace9b34d58299e783b33db66539dbd9474..36739e6d2b3092441407d0963e75d0e580fb477c 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -4,7 +4,6 @@ import { Title } from '@angular/platform-browser'; import 'rxjs/add/operator/filter'; import 'rxjs/add/operator/map'; import 'rxjs/add/operator/mergeMap'; -import { Observable } from 'rxjs/Observable'; @Component({ selector: 'app-root', diff --git a/src/app/components/organizations/edit/organization-form.component.ts b/src/app/components/organizations/edit/organization-form.component.ts index 9ea62cfdc1dd740073a458f0a76277b3e03b096b..efb91e6503ff82833fedb9a35ab39cee106e24b2 100644 --- a/src/app/components/organizations/edit/organization-form.component.ts +++ b/src/app/components/organizations/edit/organization-form.component.ts @@ -2,7 +2,6 @@ import { Component, OnInit } from '@angular/core'; import { ActivatedRoute, ParamMap, Router } from '@angular/router'; import { Organization } from 'src/app/models/organization.model'; import { OrganizationService } from 'src/app/services/organization.service'; -import { isNumeric } from 'rxjs/util/isNumeric'; import { FormBuilder, FormGroup, Validators, FormArray } from '@angular/forms'; @Component({ diff --git a/src/environments/environment.prod.ts b/src/environments/environment.dev.ts similarity index 66% rename from src/environments/environment.prod.ts rename to src/environments/environment.dev.ts index a8eb3be7ae04e691ac724d2a2fad6bd85bca9b5c..8daa21d0eeee59bc97995f77cc5919d85068d8bb 100644 --- a/src/environments/environment.prod.ts +++ b/src/environments/environment.dev.ts @@ -1,5 +1,5 @@ -const kongBaseUrl = 'https://kong.alpha.grandlyon.com'; +const kongBaseUrl = 'https://kong-dev.alpha.grandlyon.com'; export const environment = { production: true, diff --git a/src/environments/environment.rec.ts b/src/environments/environment.rec.ts new file mode 100644 index 0000000000000000000000000000000000000000..67412c195027c0ba928dc5a566cac74f5f720ce0 --- /dev/null +++ b/src/environments/environment.rec.ts @@ -0,0 +1,10 @@ + +const kongBaseUrl = 'https://kong-rec.alpha.grandlyon.com'; + +export const environment = { + production: true, + + organizations: { + url: kongBaseUrl + '/organizations/', + }, +};