From 3004e1e2bacbf0f4719dbaee9609278b7d902f5b Mon Sep 17 00:00:00 2001 From: Pavel Konovalov Date: Wed, 13 May 2026 15:52:25 +0300 Subject: [PATCH] Building and run the Docker container --- .gitignore | 1 + Dockerfile | 19 +++++++++++++++++++ README.md | 34 ++++++++++++++++++++++++++++------ docker-compose.yml | 8 ++++++++ nginx.conf | 19 +++++++++++++++++++ 5 files changed, 75 insertions(+), 6 deletions(-) create mode 100644 Dockerfile create mode 100644 docker-compose.yml create mode 100644 nginx.conf diff --git a/.gitignore b/.gitignore index 21319de..5da9fc7 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ dist/ .env .env.* *.log +.idea diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..823c789 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,19 @@ +FROM node:22-alpine AS build + +WORKDIR /app + +COPY package.json pnpm-lock.yaml ./ +RUN corepack enable && pnpm install --frozen-lockfile + +COPY . . +# Uses the same build command documented in README.md (pnpm build) +RUN pnpm build + +FROM nginx:1.27-alpine AS runtime + +COPY nginx.conf /etc/nginx/conf.d/default.conf +COPY --from=build /app/dist /usr/share/nginx/html + +EXPOSE 80 +CMD ["nginx", "-g", "daemon off;"] + diff --git a/README.md b/README.md index 1ab8a8c..d4e08d5 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,8 @@ ## Overview -**Mas Ari ADS Simulator** is a personal open-source coding exploration for learning and teaching smart defense scheme logic based on fast power-flow-aware load shedding. +**Mas Ari ADS Simulator** is a personal open-source coding exploration for learning and teaching smart defense scheme +logic based on fast power-flow-aware load shedding. This demo explores a more explainable defense scheme concept using: @@ -30,11 +31,14 @@ This demo explores a more explainable defense scheme concept using: - frequency injection scenarios, - and blackstart / restoration learning sequences. -The goal is to demonstrate that defense scheme actions should be based on electrical reasoning — power direction, source availability, grid/IBT support, island balance, equipment loading, and final system impact — not only on a fixed static trip list. +The goal is to demonstrate that defense scheme actions should be based on electrical reasoning — power direction, source +availability, grid/IBT support, island balance, equipment loading, and final system impact — not only on a fixed static +trip list. ## Learning and Teaching Use -This project can be used by engineers, students, trainers, educators, and power-system practitioners to learn and teach smart defense scheme concepts, especially fast power-flow-aware load shedding and explainable trip-matrix logic. +This project can be used by engineers, students, trainers, educators, and power-system practitioners to learn and teach +smart defense scheme concepts, especially fast power-flow-aware load shedding and explainable trip-matrix logic. It is intended as an educational and exploratory simulator, not as a protection-grade or operational control system. @@ -52,9 +56,11 @@ It is intended as an educational and exploratory simulator, not as a protection- This project is a personal, independent, open-source exploration. -It is **not** a commercial product. It is **not** affiliated with, endorsed by, or representing any company, employer, utility, vendor, customer system, or project owner. +It is **not** a commercial product. It is **not** affiliated with, endorsed by, or representing any company, employer, +utility, vendor, customer system, or project owner. -No confidential customer data, utility data, employer data, or proprietary project information is intended to be included in this repository. +No confidential customer data, utility data, employer data, or proprietary project information is intended to be +included in this repository. ## Development @@ -82,6 +88,21 @@ Preview the production build: pnpm preview ``` +### Docker development environment: + +Create `.env` file with: + +```text +PORT= +``` + +Then build and run the Docker container: + +```bash +docker compose build +docker compose up -d +``` + ## GitHub Pages Notes This repository is intended to be published as: @@ -96,7 +117,8 @@ The Vite base path is configured as: base: "/ads/"; ``` -If the repository is renamed again, update `base` in `vite.config.ts` and the public URLs in `index.html` and this README. +If the repository is renamed again, update `base` in `vite.config.ts` and the public URLs in `index.html` and this +README. ## License diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..a1e6888 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,8 @@ +services: + ads: + build: + context: . + dockerfile: Dockerfile + ports: + - "${PORT:-8080}:80" + restart: unless-stopped diff --git a/nginx.conf b/nginx.conf new file mode 100644 index 0000000..4b827aa --- /dev/null +++ b/nginx.conf @@ -0,0 +1,19 @@ +server { + listen 80; + server_name _; + + root /usr/share/nginx/html; + index index.html; + + # This build uses Vite base=/ads/, so redirect root to that path. + location = / { + return 302 /ads/; + } + + # Strip /ads/ prefix and serve the built SPA. + location /ads/ { + rewrite ^/ads/(.*)$ /$1 break; + try_files $uri $uri/ /index.html; + } +} +