From f6dbf489adb69b7b548c987690e31cac688b168d Mon Sep 17 00:00:00 2001 From: ThompsonNye Date: Mon, 23 Jun 2025 18:38:26 +0200 Subject: [PATCH] Dockerize web app --- src/Vegasco-Web/.dockerignore | 10 ++++++++++ src/Vegasco-Web/Dockerfile | 13 +++++++++++++ src/Vegasco-Web/angular.json | 2 +- src/Vegasco-Web/nginx.conf | 13 +++++++++++++ src/Vegasco-Web/package.json | 4 +++- 5 files changed, 40 insertions(+), 2 deletions(-) create mode 100644 src/Vegasco-Web/.dockerignore create mode 100644 src/Vegasco-Web/Dockerfile create mode 100644 src/Vegasco-Web/nginx.conf diff --git a/src/Vegasco-Web/.dockerignore b/src/Vegasco-Web/.dockerignore new file mode 100644 index 0000000..6b38648 --- /dev/null +++ b/src/Vegasco-Web/.dockerignore @@ -0,0 +1,10 @@ +node_modules +npm-debug.log +Dockerfile* +docker-compose* +.dockerignore +.git +.gitignore +README.md +LICENSE +.vscode diff --git a/src/Vegasco-Web/Dockerfile b/src/Vegasco-Web/Dockerfile new file mode 100644 index 0000000..578e7eb --- /dev/null +++ b/src/Vegasco-Web/Dockerfile @@ -0,0 +1,13 @@ +FROM node:lts AS build +RUN npm install -g pnpm +ARG CONFIGURATION=development +WORKDIR /usr/local/app +COPY . . +RUN pnpm install +RUN pnpm "build:$CONFIGURATION" + +FROM nginx:alpine +WORKDIR /usr/share/nginx/html +COPY --from=build /usr/local/app/dist/Vegasco-Web/browser . +COPY nginx.conf /etc/nginx/nginx.conf +EXPOSE 80 diff --git a/src/Vegasco-Web/angular.json b/src/Vegasco-Web/angular.json index 5e6e817..776e5f4 100644 --- a/src/Vegasco-Web/angular.json +++ b/src/Vegasco-Web/angular.json @@ -17,7 +17,7 @@ "build": { "builder": "@angular-devkit/build-angular:application", "options": { - "outputPath": "dist/tmp", + "outputPath": "dist/Vegasco-Web", "index": "src/index.html", "browser": "src/main.ts", "polyfills": [ diff --git a/src/Vegasco-Web/nginx.conf b/src/Vegasco-Web/nginx.conf new file mode 100644 index 0000000..340e459 --- /dev/null +++ b/src/Vegasco-Web/nginx.conf @@ -0,0 +1,13 @@ +events { } +http { + include mime.types; + + server { + listen 80; + + location / { + root /usr/share/nginx/html; + try_files $uri $uri/ /index.html =404; + } + } +} diff --git a/src/Vegasco-Web/package.json b/src/Vegasco-Web/package.json index 9a18012..8ab96ff 100644 --- a/src/Vegasco-Web/package.json +++ b/src/Vegasco-Web/package.json @@ -7,7 +7,9 @@ "start": "run-script-os", "start:win32": "ng serve --port %PORT% --configuration development", "start:default": "ng serve --port $PORT --configuration development", - "build": "ng build", + "build": "pnpm build:development", + "build:development": "ng build", + "build:production": "ng build --configuration production", "watch": "ng build --watch --configuration development", "test": "ng test" },