-
Notifications
You must be signed in to change notification settings - Fork 9
Split Docker images into base and product images for improved efficiency #323
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
760dabb
Update docker hub readme task and fix version in README (#316)
ptr727 de8c534
Update GitHub Copilot guidance, enhance Docker build caching, and mod…
ptr727 91675e2
Merge branch 'main' into develop
ptr727 59fefe1
feat: Split docker images into base and product images to improve bui…
ptr727 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,37 +1,51 @@ | ||
| # 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. | ||
|
|
||
| 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. | ||
|
|
||
| This repository builds and publishes Docker images for Network Optix VMS products (Nx Witness, Nx Meta, Nx Go, DW Spectrum, Wisenet WAVE). It includes base images (nx-base, nx-base-lsio) and derived product images, plus 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/). | ||
| - Outputs: Dockerfiles in [Docker/](../Docker/) (base images and derived product images) 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. | ||
|
|
||
| ### Image Architecture | ||
|
|
||
| - Base images (`nx-base`, `nx-base-lsio`) are built and pushed, then used as `FROM` images for derived product Dockerfiles. | ||
| - Derived images should track base image tag changes (for example, the Ubuntu distro tag) to keep builds consistent. | ||
|
|
||
| ## What to Keep in Sync | ||
|
|
||
| - Generated Dockerfiles and scripts must reflect CreateMatrix behavior. | ||
| - Base image Dockerfiles and derived image Dockerfiles should remain aligned since derived images build on the base images. | ||
| - 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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,67 @@ | ||
| name: Build base images task | ||
|
|
||
| on: | ||
| workflow_call: | ||
| inputs: | ||
| push: | ||
| required: false | ||
| type: boolean | ||
| default: true | ||
|
|
||
| jobs: | ||
|
|
||
| build-base: | ||
| name: Build base image job | ||
| runs-on: ubuntu-latest | ||
|
|
||
| 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 | ||
|
|
||
| steps: | ||
|
|
||
| - name: Checkout step | ||
| uses: actions/checkout@v6 | ||
|
|
||
| - name: Setup QEMU step | ||
| uses: docker/setup-qemu-action@v3 | ||
| with: | ||
| platforms: linux/amd64,linux/arm64 | ||
|
|
||
| - name: Setup Buildx step | ||
| uses: docker/setup-buildx-action@v3 | ||
| with: | ||
| platforms: linux/amd64,linux/arm64 | ||
|
|
||
| - name: Login to Docker Hub step | ||
| uses: docker/login-action@v3 | ||
| with: | ||
| registry: docker.io | ||
| username: ${{ secrets.DOCKER_HUB_USERNAME }} | ||
| password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} | ||
|
|
||
| - name: Docker build and push base step | ||
| uses: docker/build-push-action@v6 | ||
| with: | ||
| push: ${{ inputs.push && (github.ref_name == 'main' || github.ref_name == 'develop') }} | ||
| context: Docker | ||
| file: ${{ matrix.base.dockerfile }} | ||
| platforms: linux/amd64,linux/arm64 | ||
| tags: ${{ matrix.base.tags }} | ||
| cache-from: | | ||
| type=registry,ref=${{ matrix.base.tags }} | ||
| 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) || '' }} | ||
| cache-to: | | ||
| ${{ inputs.push && (github.ref_name == 'main' || github.ref_name == 'develop') && format('type=gha,mode=max,scope={0}-base-{1}', github.ref_name, matrix.base.name) || '' }} | ||
| ${{ inputs.push && (github.ref_name == 'main' || github.ref_name == 'develop') && 'type=inline' || '' }} | ||
| ${{ github.event.pull_request && !github.event.pull_request.head.repo.fork && format('type=gha,mode=max,scope=pr-base-{0}-{1}', github.event.pull_request.number, matrix.base.name) || '' }} | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,7 +18,6 @@ jobs: | |
| permissions: | ||
| contents: write | ||
| with: | ||
| # Publish | ||
| github: true | ||
| dockerhub: true | ||
|
|
||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.