From a69e19f917a17aa31d1922c77a8c0b0ce2469de9 Mon Sep 17 00:00:00 2001 From: rem Date: Sun, 30 Jun 2024 02:19:42 +0200 Subject: [PATCH] pp3 --- Dockerfile | 19 +++++++++---------- angular.json | 1 - nginx.conf | 14 ++++++++++++++ 3 files changed, 23 insertions(+), 11 deletions(-) create mode 100644 nginx.conf diff --git a/Dockerfile b/Dockerfile index 2ed28fc..5ccd60a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,13 +1,12 @@ -FROM node:alpine - +### STAGE 1: Build ### +FROM node:alpine AS build WORKDIR /usr/src/app - -COPY . /usr/src/app - -RUN npm install -g @angular/cli - +COPY package.json package-lock.json ./ RUN npm install +COPY . . +RUN npm run build -EXPOSE 8080 - -CMD ["ng", "serve", "--host", "0.0.0.0", "--port", "8080"] +### STAGE 2: Run ### +FROM nginx:alpine +COPY nginx.conf /etc/nginx/nginx.conf +COPY --from=build /usr/src/app/dist/portfolioo/browser /usr/share/nginx/html diff --git a/angular.json b/angular.json index f66fb9e..47d129d 100644 --- a/angular.json +++ b/angular.json @@ -13,7 +13,6 @@ "build": { "builder": "@angular-devkit/build-angular:application", "options": { - "baseHref" : "https://codefirst.iut.uca.fr/containers/remiarnal-portfolioo/", "outputPath": "dist/portfolioo", "index": "src/index.html", "browser": "src/main.ts", diff --git a/nginx.conf b/nginx.conf new file mode 100644 index 0000000..d99dfe1 --- /dev/null +++ b/nginx.conf @@ -0,0 +1,14 @@ +events{} + +http { + include /etc/nginx/mime.types; + server { + listen 8080; + server_name localhost; + root /usr/share/nginx/html; + index index.html; + location / { + try_files $uri $uri/ /index.html; + } + } +}