CLI and Publish Tests

This commit was merged in pull request #63.
This commit is contained in:
2026-06-02 12:12:38 -04:00
parent 7da6f554a8
commit 85834466f1
71 changed files with 511 additions and 54 deletions
+62
View File
@@ -0,0 +1,62 @@
# Containerizing the IGP App with Docker
## Steps Performed
### 1. Created a MultiStage Dockerfile (`Dockerfile`)
Two stages:
| Stage | Image | Purpose |
|---|---|---|
| `build` | `mcr.microsoft.com/dotnet/sdk:10.0` | Restores dependencies, builds, and publishes the Blazor WASM app |
| `final` | `nginx:alpine` | Copies the published `wwwroot/` output and a custom `nginx.conf` that serves it |
### 2. Created a Custom nginx Config (`nginx.conf`)
- Listens on port **8887** (not the default 80) so it doesn't conflict with other containers.
- Adds Blazorrequired MIME types: `application/wasm` (`.wasm`), `application/octet-stream` (`.dll`, `.blat`, `.dat`, `.webcil`).
- Enables `gzip_static` so precompressed `.gz` variants are served automatically.
- Implements SPA fallback: `try_files $uri $uri/ /index.html` for clientside routing.
### 3. Built the Image
```
docker build -t igp-app:latest -f Dockerfile .
```
Result: `docker.io/library/igp-app:latest`
### 4. Ran the Container
```
docker run -d --name igp-app -p 8887:8887 igp-app:latest
```
The container is now serving at **http://localhost:8887**.
### 5. Verified
- `docker ps` shows the container `Up` and port mapping `0.0.0.0:8887->8887/tcp`.
- `curl http://localhost:8887/` returns HTTP `200`.
## Files
| File | Purpose |
|---|---|
| `Dockerfile` | Multistage build: .NET SDK → publish → nginx |
| `nginx.conf` | nginx config with Blazor MIME types, gzip, SPA fallback, port 8887 |
## How to Stop
```
docker stop igp-app
docker rm igp-app
```
## How to Rebuild
```
docker build -t igp-app:latest -f Dockerfile .
docker rm -f igp-app
docker run -d --name igp-app -p 8887:8887 igp-app:latest
```
+51
View File
@@ -0,0 +1,51 @@
# Publishing and Serving the IGP App Locally
## Steps Performed
### 1. Publish the Blazor WebAssembly App
Ran `dotnet publish` targeting Release configuration, outputting to `publish_release/`:
```
dotnet publish .\IGP\IGP.csproj -c Release -o .\publish_release
```
This produced a standard Blazor WASM publish layout:
- `publish_release/wwwroot/` — static assets (HTML, CSS, JS, WASM, DLLs)
- `publish_release/dotnet.js` — .NET runtime loader
- `publish_release/web.config` — IIS configuration
### 2. Serve the Published Files on Port 8777
Wrote a small Node.js static file server (`serve_publish.cjs`) that:
- Serves files from `publish_release/wwwroot/`
- Maps correct MIME types for `.wasm` ( `application/wasm` ), `.dll` ( `application/octet-stream` ), `.js` ( `application/javascript` ), `.br`, `.gz`
- Implements SPA fallback: non-file routes serve `index.html` so Blazor's client-side routing works on refresh
```
node serve_publish.cjs
```
Server is now running at **http://localhost:8777**.
### 3. Verify
- `netstat -ano | findstr ":8777"` confirms the process is LISTENING
- `curl -s -o NUL -w "%{http_code}" http://localhost:8777/` returns `200`
## How to Stop
Find the process and kill it:
```
netstat -ano | findstr ":8777.*LISTENING"
Stop-Process -Id <PID>
```
## Files
| File | Purpose |
|---|---|
| `publish_release/wwwroot/` | Published static output |
| `serve_publish.cjs` | Simple Node.js HTTP server with Blazor MIME support |