Skip to content

Fix CLI overriding Dockerfile BEAM_DOTNET_VERSION with hardcoded alpine tag#4539

Draft
Copilot wants to merge 4 commits intomainfrom
copilot/fix-dockerfile-beam-dotnet-version-override
Draft

Fix CLI overriding Dockerfile BEAM_DOTNET_VERSION with hardcoded alpine tag#4539
Copilot wants to merge 4 commits intomainfrom
copilot/fix-dockerfile-beam-dotnet-version-override

Conversation

Copy link
Copy Markdown

Copilot AI commented Mar 19, 2026

Ticket

https://disruptorbeam.atlassian.net/browse/BEAM-XXXX

Brief Description

CLI always passed --build-arg BEAM_DOTNET_VERSION=X.0-alpine to docker buildx build, making it impossible to use non-alpine base images (e.g. noble). The tag was computed solely from TargetFramework, ignoring user intent.

Fix: Read the ContainerFamily MSBuild property from the service's .csproj (same pattern as TargetFramework) and combine it with the parsed dotnet version to form the tag.

  • ServicesBuildCommand.cs
    • Reads ContainerFamily via msbuildProject.GetPropertyValue("ContainerFamily")
    • Replaced GetDefaultBaseImageTag(targetFramework) with GetBaseImageTag(targetFramework, containerFamily)
    • Version extracted generically from the TFM moniker (net10.010.0) — no hardcoded version list, forward-compatible
    • ContainerFamily validated against { "alpine", "noble" }; defaults to "alpine" if absent or unrecognised

Usage: Set <ContainerFamily>noble</ContainerFamily> in the service .csproj. The CLI will pass --build-arg BEAM_DOTNET_VERSION=10.0-noble automatically.

Checklist

  • Have you added appropriate text to the CHANGELOG.md files?

Notes

When you are merging a feature branch into main, please squash merge and make sure the final commit contains any relevent JIRA ticket number. If you are merging from main to staging, or staging to production, please use a regular merge commit.

Does this introduce tech-debt? If so, have you added an entry to the Tech-debt document?

Original prompt

This section details on the original issue you should resolve

<issue_title>CLI7 overrides Dockerfile BEAM_DOTNET_VERSION ARG</issue_title>
<issue_description>## Describe the Bug

Change in the MS build command overrides Dockerfile ARG BEAM_DOTNET_VERSION.
Arguments passed in with --build-arg will override default definitions in the Dockerfile, they are used only if not present in the --build-arg.
This results in the inability to use any other base image for the MS.

To Reproduce

Steps to reproduce the behavior:

  1. Create new CLI 7 project
  2. Create new MS
  3. Change ARG BEAM_DOTNET_VERSION in the Dockerfile to 10.0-noble
  4. After FROM mcr.microsoft.com/dotnet/runtime:${BEAM_DOTNET_VERSION} add:
    • RUN apt-get update && apt-get install -y git (arbitrary noble command)
  5. Run dotnet beam deploy plan

Expected Behavior

dotnet beam deploy plan should execute successfully with 10.0-noble base image.

Actual Behavior

dotnet beam deploy plan fails because it uses hard-coded 10.0-alpine base image.

Screenshots

Failed to build service=[GfxService]
starting docker build...
[internal] load build definition from Dockerfile
transferring dockerfile:
[internal] load metadata for mcr.microsoft.com/dotnet/runtime:10.0-alpine
[internal] load .dockerignore
transferring context:
[1/6] FROM mcr.microsoft.com/dotnet/runtime:10.0-alpine@sha256:df50bf8048e1d38c9b9d757eeeac29ce966f9df5f4bd394452189673928ad640
[internal] load build context
resolve mcr.microsoft.com/dotnet/runtime:10.0-alpine@sha256:df50bf8048e1d38c9b9d757eeeac29ce966f9df5f4bd394452189673928ad640
[2/6] RUN apt-get update && apt-get install -y git
/bin/sh: apt-get: not found

[failed] process "/bin/sh -c apt-get update && apt-get install -y git" did not complete successfully: exit code: 127

</issue_description>

<agent_instructions>make it so that the default behaviour is to...

  • use -

The target framework is already being sourced from the csproj file, so use that as inspriration, but due the same thing for . It should default to "alpine" if no property exists. </agent_instructions>

Comments on the Issue (you are @copilot in this section)

@cdhanna We could solve this by adhering to the dotnet standard, https://codewithmukesh.com/blog/containerize-dotnet-without-dockerfile/ (use the `` msbuild property )

The workaround for now is to change the dockerfile to just say this,

FROM mcr.microsoft.com/dotnet/runtime:10.0-noble
```</body></comment_new>
<comment_new><author>@zpatekar</author><body>
Hey @cdhanna using `Microsoft.NET.Build.Containers` can solve one part of the issue, changing the base image, but fuhrer customization are not possible, example [here](https://github.com/beamable/Stellar-Project/blob/main/Unity/BeamableServices/services/StellarFederation/Dockerfile) (eg. installing Rust, custom libs...)  
Based on this I see 3 outcomes:

1. we won't support those kind of modifications in the future
2. we'll use `Microsoft.NET.Build.Containers` with 2 options:
     - customers will write and publish custom base image to their own registry
     - customers will write and publish custom base image to our registry

1. we'll keep the Dockerfile</body></comment_new>
</comments>

🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

Copilot AI and others added 2 commits March 19, 2026 18:56
…ld command

Co-authored-by: cdhanna <3848374+cdhanna@users.noreply.github.com>
…e casing

Co-authored-by: cdhanna <3848374+cdhanna@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix Dockerfile BEAM_DOTNET_VERSION ARG override issue Fix CLI7 overriding Dockerfile BEAM_DOTNET_VERSION ARG Mar 19, 2026
Copilot AI requested a review from cdhanna March 19, 2026 18:57
…RSION

Co-authored-by: cdhanna <3848374+cdhanna@users.noreply.github.com>
Copilot AI changed the title Fix CLI7 overriding Dockerfile BEAM_DOTNET_VERSION ARG Fix CLI overriding Dockerfile BEAM_DOTNET_VERSION with hardcoded alpine tag Mar 19, 2026
@cdhanna
Copy link
Copy Markdown
Collaborator

cdhanna commented Mar 19, 2026

@docnerd, doc for core/v7.1

@github-actions
Copy link
Copy Markdown
Contributor

I am docNerd. yes, working on it. Watch the workflow

@github-actions
Copy link
Copy Markdown
Contributor

I am docNerd. I reviewed the PR but didn't find documentation changes that needed to be made.

@cdhanna
Copy link
Copy Markdown
Collaborator

cdhanna commented Mar 19, 2026

@docnerd, doc for core/v7.1

@github-actions
Copy link
Copy Markdown
Contributor

I am docNerd. yes, working on it. Watch the workflow

@github-actions
Copy link
Copy Markdown
Contributor

I am docNerd. I reviewed the PR but didn't find documentation changes that needed to be made.

@cdhanna
Copy link
Copy Markdown
Collaborator

cdhanna commented Mar 19, 2026

@docnerd, doc for core/v7.1

@github-actions
Copy link
Copy Markdown
Contributor

I am docNerd. yes, working on it. Watch the workflow

@cdhanna
Copy link
Copy Markdown
Collaborator

cdhanna commented Mar 19, 2026

@docnerd, doc for core/v7.1

@github-actions
Copy link
Copy Markdown
Contributor

I am docNerd. yes, working on it. Watch the workflow

@github-actions
Copy link
Copy Markdown
Contributor

I am docNerd. I reviewed the PR but didn't find documentation changes that needed to be made.

@cdhanna
Copy link
Copy Markdown
Collaborator

cdhanna commented Mar 19, 2026

@docnerd, doc for core/v7.1

@github-actions
Copy link
Copy Markdown
Contributor

I am docNerd. yes, working on it. Watch the workflow

@github-actions
Copy link
Copy Markdown
Contributor

I am docNerd. Here is the link to the Doc changes: beamable/docs#47

@cdhanna
Copy link
Copy Markdown
Collaborator

cdhanna commented Mar 19, 2026

@docnerd, doc for core/v7.1

@github-actions
Copy link
Copy Markdown
Contributor

I am docNerd. yes, working on it. Watch the workflow

@github-actions
Copy link
Copy Markdown
Contributor

I am docNerd. Here is the link to the Doc changes: beamable/docs#48

@cdhanna
Copy link
Copy Markdown
Collaborator

cdhanna commented Mar 19, 2026

@docnerd, doc for core/v7.1

@github-actions
Copy link
Copy Markdown
Contributor

I am docNerd. yes, working on it. Watch the workflow

@github-actions
Copy link
Copy Markdown
Contributor

I am docNerd. Here is the link to the Doc changes: beamable/docs#49

@cdhanna
Copy link
Copy Markdown
Collaborator

cdhanna commented Mar 19, 2026

@docnerd, doc for core/v7.1

@github-actions
Copy link
Copy Markdown
Contributor

I am docNerd. yes, working on it. Watch the workflow

@github-actions
Copy link
Copy Markdown
Contributor

I am docNerd. I ran into an error generating docs: Error code: 400 - {'type': 'error', 'error': {'type': 'invalid_request_error', 'message': 'input length and max_tokens exceed context limit: 198528 + 16000 > 200000, decrease input length or max_tokens and try again'}, 'request_id': 'req_011CZD5dCzt3G4sNJGdq71tZ'}

@cdhanna
Copy link
Copy Markdown
Collaborator

cdhanna commented Mar 21, 2026

@docnerd, doc for core/v7.1

@github-actions
Copy link
Copy Markdown
Contributor

I am docNerd. yes, working on it. Watch the workflow

@docnerd
Copy link
Copy Markdown

docnerd commented Mar 23, 2026

I am also docnerd. :-) This could create confusion, no?

@cdhanna
Copy link
Copy Markdown
Collaborator

cdhanna commented Mar 23, 2026

I am also docnerd. :-) This could create confusion, no?

Ah, many apologies friend. I was not using my brain. I am developing a tool to help capture changes as documentation updates. But yes, I should not have picked an existing user name.

@cdhanna
Copy link
Copy Markdown
Collaborator

cdhanna commented Mar 23, 2026

docnerd, doc for core/v7.1

@cdhanna
Copy link
Copy Markdown
Collaborator

cdhanna commented Mar 23, 2026

docNerd, doc for core/v7.1

1 similar comment
@cdhanna
Copy link
Copy Markdown
Collaborator

cdhanna commented Mar 23, 2026

docNerd, doc for core/v7.1

@github-actions
Copy link
Copy Markdown
Contributor

I am docNerd. yes, working on it. Watch the workflow

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.

CLI7 overrides Dockerfile BEAM_DOTNET_VERSION ARG

3 participants