From 8b9e3095f2c54ab1ceafa50c9f5393d0551b08a9 Mon Sep 17 00:00:00 2001 From: Pieter Viljoen Date: Wed, 4 Feb 2026 19:29:49 -0500 Subject: [PATCH 1/4] Develop (#319) * Update docker hub readme task and fix version in README (#316) Signed-off-by: Pieter Viljoen * Update GitHub Copilot guidance, enhance Docker build caching, and modify workspace settings (#318) * Update docker hub readme task and fix version in README (#316) (#317) Signed-off-by: Pieter Viljoen * Update GitHub Copilot guidance, enhance Docker build caching, and modify workspace settings Signed-off-by: Pieter Viljoen --------- Signed-off-by: Pieter Viljoen --------- Signed-off-by: Pieter Viljoen --- .github/copilot-instructions.md | 8 ++++++++ .github/workflows/build-docker-task.yml | 8 +++++--- HISTORY.md | 1 + NxWitness.code-workspace | 1 + 4 files changed, 15 insertions(+), 3 deletions(-) diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md index af2f406..269352c 100644 --- a/.github/copilot-instructions.md +++ b/.github/copilot-instructions.md @@ -1,9 +1,11 @@ # GitHub Copilot Guidance ## Purpose + This file summarizes the solution and defines the hierarchy of guidance for AI-assisted contributions. ## Guidance Hierarchy (Must Follow) + 1. [CODESTYLE.md](../CODESTYLE.md) is the master code style and formatting authority. 2. [AGENTS.md](../AGENTS.md) is secondary guidance describing the solution, workflows, and conventions. 3. Repository configuration files such as [`.editorconfig`](../.editorconfig) and [`.vscode/tasks.json`](../.vscode/tasks.json) define enforced formatting, line endings, and task expectations. @@ -11,27 +13,33 @@ This file summarizes the solution and defines the hierarchy of guidance for AI-a If any instruction conflicts, follow CODESTYLE.md first, then AGENTS.md. ## Solution Summary + This repository builds and publishes Docker images for Network Optix VMS products (Nx Witness, Nx Meta, Nx Go, DW Spectrum, Wisenet WAVE). It includes a .NET tooling project that generates Dockerfiles, matrices, and version inputs used by CI and packaging scripts. ### Core Projects + - `CreateMatrix` (.NET 10 console app): Generates Dockerfiles and build matrix data using version and release metadata. - `CreateMatrixTests` (xUnit v3 + AwesomeAssertions): Validates release handling and version forwarding. ### Key Inputs and Outputs + - Inputs: version and matrix data in `version.json`, [Make/Version.json](../Make/Version.json), and [Make/Matrix.json](../Make/Matrix.json). - Outputs: Dockerfiles in [Docker/](../Docker/) and compose/test artifacts in [Make/](../Make/). - Templates: Unraid container templates in [Unraid/](../Unraid/). ### Build and Validation Workflow (High Level) + - Primary entry points are the `CreateMatrix` CLI commands (version, matrix, make) run directly or via scripts in [Make/](../Make/). - Formatting and style verification are enforced by CSharpier and dotnet format, with Husky.Net hooks. - The `.Net Format` VS Code task in [`.vscode/tasks.json`](../.vscode/tasks.json) must be clean and warning-free at all times. ## What to Keep in Sync + - Generated Dockerfiles and scripts must reflect CreateMatrix behavior. - Documentation in [README.md](../README.md) and release notes should align with current outputs and supported product variants. ## Expectations for Changes + - Follow the zero-warnings policy and formatting requirements in [CODESTYLE.md](../CODESTYLE.md). - Use explicit types (no `var`), Allman braces, file-scoped namespaces, and other conventions as defined in the master style guide. - Respect line endings and encoding rules from the repository configuration, including UTF-8 without BOM. diff --git a/.github/workflows/build-docker-task.yml b/.github/workflows/build-docker-task.yml index df13710..fb40eb5 100644 --- a/.github/workflows/build-docker-task.yml +++ b/.github/workflows/build-docker-task.yml @@ -87,11 +87,13 @@ jobs: - name: Docker build and push step uses: docker/build-push-action@v6 with: - push: ${{ inputs.push && (github.ref_name == matrix.images.Branch)}} - cache-from: type=gha,scope=${{ matrix.images.CacheScope }} - cache-to: type=gha,mode=max,scope=${{ matrix.images.CacheScope }} + push: ${{ inputs.push && (github.ref_name == matrix.images.Branch) }} context: Docker file: Docker/${{ matrix.images.Name }}.Dockerfile platforms: linux/amd64,linux/arm64 tags: ${{ steps.tagsargs.outputs.tags }} build-args: ${{ steps.tagsargs.outputs.args }} + cache-from: | + type=gha,scope=develop-${{ matrix.images.Name }} + type=gha,scope=main-${{ matrix.images.Name }} + cache-to: ${{ (github.ref_name == 'main' || github.ref_name == 'develop') && format('type=gha,mode=max,scope={0}-{1}', github.ref_name, matrix.images.Name) || 'type=gha,mode=min,scope=ro' }} diff --git a/HISTORY.md b/HISTORY.md index bad8666..1d684c2 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -8,6 +8,7 @@ This is a project to build and publish docker images for various [Network Optix] - Refactoring to match layout and style used in other projects. - Updated to .NET 10, adding support for Nullable, and AOT. - Restructured CLI handling logic. + - Update GHA cache usage to prevent the cache from running out of space. - Version 2.8: - Add default `analytics` volume, along with `media` and `backup` volumes, media server complains when sharing analytics storage. - Version 2.7: diff --git a/NxWitness.code-workspace b/NxWitness.code-workspace index c6ac0d3..15e882f 100644 --- a/NxWitness.code-workspace +++ b/NxWitness.code-workspace @@ -75,6 +75,7 @@ "ssdpool", "subvol", "subvolid", + "tagsargs", "TARGETARCH", "TARGETPLATFORM", "tmpfs", From 403300af208216edf24486957fe99ebc5472ad64 Mon Sep 17 00:00:00 2001 From: Pieter Viljoen Date: Wed, 4 Feb 2026 20:39:30 -0500 Subject: [PATCH 2/4] Fix syntax in jq command for generating docker hub repositories (#320) Signed-off-by: Pieter Viljoen --- .github/workflows/publish-docker-readme-task.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish-docker-readme-task.yml b/.github/workflows/publish-docker-readme-task.yml index 9649fbb..dccafbd 100644 --- a/.github/workflows/publish-docker-readme-task.yml +++ b/.github/workflows/publish-docker-readme-task.yml @@ -20,7 +20,7 @@ jobs: id: getrepos # Create array of docker hub repositories from matrix.json run: | - echo "repos=$(jq --compact-output '[.Images[].Name | ascii_downcase | \"ptr727/\\(.)\"] | sort | unique' ./Make/Matrix.json)" >> "$GITHUB_OUTPUT" + echo "repos=$(jq --compact-output '[.Images[].Name | ascii_downcase | "ptr727/\(.)" ] | sort | unique' ./Make/Matrix.json)" >> "$GITHUB_OUTPUT" publish-readme: name: Publish docker hub readme job From eb5eed020544b3429998012bb1c4061139ec5904 Mon Sep 17 00:00:00 2001 From: Pieter Viljoen Date: Thu, 5 Feb 2026 02:00:33 -0500 Subject: [PATCH 3/4] Update cache-to logic in Docker build step for feature branches (#321) Signed-off-by: Pieter Viljoen --- .github/workflows/build-docker-task.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-docker-task.yml b/.github/workflows/build-docker-task.yml index fb40eb5..f4656b8 100644 --- a/.github/workflows/build-docker-task.yml +++ b/.github/workflows/build-docker-task.yml @@ -96,4 +96,4 @@ jobs: cache-from: | type=gha,scope=develop-${{ matrix.images.Name }} type=gha,scope=main-${{ matrix.images.Name }} - cache-to: ${{ (github.ref_name == 'main' || github.ref_name == 'develop') && format('type=gha,mode=max,scope={0}-{1}', github.ref_name, matrix.images.Name) || 'type=gha,mode=min,scope=ro' }} + cache-to: ${{ (github.ref_name == 'main' || github.ref_name == 'develop') && format('type=gha,mode=max,scope={0}-{1}', github.ref_name, matrix.images.Name) || format('type=gha,mode=min,scope=feature-{0}', matrix.images.Name) }} From 5e368507c2258be7cf74d54bf500bcf256a9725b Mon Sep 17 00:00:00 2001 From: Pieter Viljoen Date: Thu, 5 Feb 2026 15:42:53 -0800 Subject: [PATCH 4/4] fix: Add cache_tag to base image definitions for improved caching in Docker builds Signed-off-by: Pieter Viljoen --- .github/workflows/build-base-images-task.yml | 24 +++++++++++--------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/.github/workflows/build-base-images-task.yml b/.github/workflows/build-base-images-task.yml index c59ff42..9705c6e 100644 --- a/.github/workflows/build-base-images-task.yml +++ b/.github/workflows/build-base-images-task.yml @@ -17,14 +17,16 @@ jobs: strategy: matrix: base: - - name: nx-base - dockerfile: Docker/NxBase.Dockerfile - tags: | - docker.io/ptr727/nx-base:ubuntu-noble - - name: nx-base-lsio - dockerfile: Docker/NxBase-LSIO.Dockerfile - tags: | - docker.io/ptr727/nx-base-lsio:ubuntu-noble + - name: nx-base + dockerfile: Docker/NxBase.Dockerfile + cache_tag: docker.io/ptr727/nx-base:ubuntu-noble + tags: | + docker.io/ptr727/nx-base:ubuntu-noble + - name: nx-base-lsio + dockerfile: Docker/NxBase-LSIO.Dockerfile + cache_tag: docker.io/ptr727/nx-base-lsio:ubuntu-noble + tags: | + docker.io/ptr727/nx-base-lsio:ubuntu-noble steps: @@ -55,9 +57,9 @@ jobs: context: Docker file: ${{ matrix.base.dockerfile }} platforms: linux/amd64,linux/arm64 - tags: ${{ matrix.base.tags }} - cache-from: | - type=registry,ref=${{ matrix.base.tags }} + tags: ${{ matrix.base.tags }} + cache-from: | + type=registry,ref=${{ matrix.base.cache_tag }} type=gha,scope=develop-base-${{ matrix.base.name }} type=gha,scope=main-base-${{ matrix.base.name }} ${{ github.event.pull_request && format('type=gha,scope=pr-base-{0}-{1}', github.event.pull_request.number, matrix.base.name) || '' }}