Skip to content

Add buildContext property to Platform manifest model#1992

Draft
Copilot wants to merge 2 commits intomainfrom
copilot/add-build-context-to-manifest
Draft

Add buildContext property to Platform manifest model#1992
Copilot wants to merge 2 commits intomainfrom
copilot/add-build-context-to-manifest

Conversation

Copy link
Contributor

Copilot AI commented Mar 3, 2026

Adds an optional buildContext property to the Platform section of the manifest. When set, the Dockerfile is built from that context directory instead of defaulting to the Dockerfile's parent directory.

Model

  • New optional BuildContext property on Platform — relative path to the build context directory for docker build

ViewModel

  • PlatformInfo uses BuildContext when present, otherwise falls back to existing behavior (Dockerfile parent dir)
  • ModelExtensions.ValidatePlatform validates BuildContext is a relative path

Usage

{
  "platforms": [
    {
      "dockerfile": "src/runtime/8.0/jammy/arm64v8/Dockerfile",
      "buildContext": "src/runtime/8.0/jammy",
      "os": "Linux",
      "osVersion": "jammy",
      "tags": { "8.0-jammy-arm64v8": {} }
    }
  ]
}

Tests

  • Serialization tests updated to cover BuildContext in fully populated platform
  • Two new PlatformInfo tests: default context (unchanged behavior) and explicit buildContext override

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: lbussell <36081148+lbussell@users.noreply.github.com>
DockerfilePath = PathHelper.NormalizePath(dockerfileWithBaseDir);
BuildContextPath = PathHelper.NormalizePath(Path.GetDirectoryName(dockerfileWithBaseDir));
BuildContextPath = model.BuildContext is not null
? PathHelper.NormalizePath(Path.Combine(baseDirectory, model.BuildContext))
platform, "", "test", variableHelper, tempFolderContext.Path);

string expectedContextPath = PathHelper.NormalizePath(
Path.Combine(tempFolderContext.Path, "src/runtime/os"));
platform, "", "test", variableHelper, tempFolderContext.Path);

string expectedContextPath = PathHelper.NormalizePath(
Path.Combine(tempFolderContext.Path, "src"));
Copilot AI changed the title [WIP] Add buildContext property to Platform section of Manifest Add buildContext property to Platform manifest model Mar 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants