From 15f607122fe5c8c54e220b591780e9448355eb6b Mon Sep 17 00:00:00 2001 From: Clement FERRERE Date: Fri, 11 Mar 2022 09:41:19 +0100 Subject: [PATCH 1/3] create docker file --- Dockerfile | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..5222aff --- /dev/null +++ b/Dockerfile @@ -0,0 +1,9 @@ +#stage 1 +FROM node:latest as node +WORKDIR /app +COPY . . +RUN npm install +RUN npm run build --prod +#stage 2 +FROM nginx:alpine +COPY --from=node /app/dist/demo-app /usr/share/nginx/html -- 2.36.3 From 5df1f2f23b560cbed65667036209ef8f3524b1b8 Mon Sep 17 00:00:00 2001 From: Clement FERRERE Date: Mon, 14 Mar 2022 09:41:16 +0100 Subject: [PATCH 2/3] Docker fonctionnel --- Dockerfile | 25 +++++++++++++++++++------ karma.conf.js | 2 -- package.json | 4 ---- 3 files changed, 19 insertions(+), 12 deletions(-) diff --git a/Dockerfile b/Dockerfile index 5222aff..004490c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,9 +1,22 @@ -#stage 1 -FROM node:latest as node +# Stage 1 + + +FROM node:16-alpine3.14 as build-step + +RUN mkdir -p /app + WORKDIR /app -COPY . . + +COPY package.json /app + RUN npm install + +COPY . /app + RUN npm run build --prod -#stage 2 -FROM nginx:alpine -COPY --from=node /app/dist/demo-app /usr/share/nginx/html + +# Stage 2 + +FROM nginx:1.17.1-alpine + +COPY --from=build-step /app/dist/Collaborateur-Epa-Front /usr/share/nginx/html diff --git a/karma.conf.js b/karma.conf.js index c02789d..4a5b2ff 100644 --- a/karma.conf.js +++ b/karma.conf.js @@ -6,9 +6,7 @@ module.exports = function (config) { basePath: '', frameworks: ['jasmine', '@angular-devkit/build-angular'], plugins: [ - require('karma-jasmine'), require('karma-chrome-launcher'), - require('karma-jasmine-html-reporter'), require('karma-coverage'), require('@angular-devkit/build-angular/plugins/karma') ], diff --git a/package.json b/package.json index 31a9338..88eace0 100644 --- a/package.json +++ b/package.json @@ -30,14 +30,10 @@ "@angular-devkit/build-angular": "~12.0.0", "@angular/cli": "~12.0.0", "@angular/compiler-cli": "~12.0.0", - "@types/jasmine": "~3.6.0", "@types/node": "^12.11.1", - "jasmine-core": "~3.7.0", "karma": "~6.3.0", "karma-chrome-launcher": "~3.1.0", "karma-coverage": "~2.0.3", - "karma-jasmine": "~4.0.0", - "karma-jasmine-html-reporter": "^1.5.0", "typescript": "~4.2.3" } } -- 2.36.3 From 11d0f20a9048fd49e3846638dcc67e0c42e6e0e3 Mon Sep 17 00:00:00 2001 From: Clement FERRERE Date: Mon, 14 Mar 2022 10:04:59 +0100 Subject: [PATCH 3/3] fix du refresh vers 404. Refresh fonctionnel --- Dockerfile | 3 +++ nginx.conf | 25 +++++++++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 nginx.conf diff --git a/Dockerfile b/Dockerfile index 004490c..e2fa3ba 100644 --- a/Dockerfile +++ b/Dockerfile @@ -19,4 +19,7 @@ RUN npm run build --prod FROM nginx:1.17.1-alpine +RUN rm -rf /usr/share/nginx/html/* && rm -rf /etc/nginx/nginx.conf +COPY ./nginx.conf /etc/nginx/nginx.conf COPY --from=build-step /app/dist/Collaborateur-Epa-Front /usr/share/nginx/html + diff --git a/nginx.conf b/nginx.conf new file mode 100644 index 0000000..ea9434b --- /dev/null +++ b/nginx.conf @@ -0,0 +1,25 @@ +worker_processes 1; + +events { + worker_connections 1024; +} + +http { + server { + listen 80; + server_name localhost; + + root /usr/share/nginx/html; + index index.html index.htm; + include /etc/nginx/mime.types; + + gzip on; + gzip_min_length 1000; + gzip_proxied expired no-cache no-store private auth; + gzip_types text/plain text/css application/json application/javascript application/x-javascript text/xml application/xml application/xml+rss text/javascript; + + location / { + try_files $uri $uri/ /index.html; + } + } +} -- 2.36.3