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
```