Skip to content

fix(build): target .NET 8 in the Docker build to match the projects - #127

Merged
MusaMisto merged 1 commit into
mainfrom
fix/dockerfile-net8
Aug 31, 2026
Merged

fix(build): target .NET 8 in the Docker build to match the projects#127
MusaMisto merged 1 commit into
mainfrom
fix/dockerfile-net8

Conversation

@MusaMisto

Copy link
Copy Markdown
Member

Root cause

The projects moved to net8.0 on 2026-02-12 (d48988f). The Dockerfile still pinned the .NET 6 base images it was last given on 2024-03-31. SDK 6 cannot build a net8.0 project:

error NETSDK1045: The current .NET SDK does not support targeting .NET 8.0.
  [/src/SW.Mtm.Web/SW.Mtm.Web.csproj]

This is not new. The CI/CD Pipeline workflow has no successful run on main in its entire visible history — every run back to 2026-06-25 failed. ci fails, so deploy and tag never run, which is exactly why nothing has been published since tag 6.0.9 (Feb 2026) and why the chart on charts.sf9.io is still 6.0.8.

Reproduced locally byte-for-byte against the CI log before changing anything.

Changes (3 lines)

File Change
Dockerfile aspnet:6.08.0, sdk:6.08.0 — match TargetFramework
Dockerfile copy SW.Mtm.MsSql.csproj into the pre-restore layer
ci-cd.yml dotnet-version: '6.0.x''8.0.x'

SW.Mtm.MsSql is a ProjectReference of SW.Mtm.Web but its csproj was never copied, so restore logged Skipping project "/src/SW.Mtm.MsSql/SW.Mtm.MsSql.csproj" because it was not found and resolved an incomplete graph in that layer. Now 0 skip warnings.

The ci-cd.yml line is currently masked — there is no global.json, so the runner picks its newest preinstalled SDK and the nuget job passes despite the 6.0.x pin (confirmed: nuget succeeded in the same run where ci failed). It is corrected because it contradicts the projects and breaks the moment a global.json appears.

⚠️ Do not merge Dependabot #117 / #118 (6.0 → 9.0)

I tested that exact combination. It is worse than the current failure, because it passes CI:

build:  ✅ sdk:9.0 builds the net8.0 projects fine
run:    ❌ You must install or update .NET to run this application.
           Framework: 'Microsoft.NETCore.App', version '8.0.0'

.NET roll-forward does not cross major versions by default, so aspnet:9.0 cannot run a net8.0 app. Those PRs would ship a green build and a crash-looping image. Close them, or retarget the projects to net9.0 first and bump both images together.

Verification

  • Failure reproduced locally, identical to the CI log.
  • docker build succeeds after the change.
  • docker run on the resulting image: Serilog initialises and EF Core executes — the app reaches application code and fails only on database connectivity, with no database configured locally. No framework-resolution error.
  • 0 Skipping project warnings in the restore layer.
  • actionlint clean.

🤖 Generated with Claude Code

https://claude.ai/code/session_01VHkpqv6dB6wjALyFe9ocMU

The Docker build has failed on every run since the projects moved to
net8.0 (d48988f, 2026-02-12). The Dockerfile still pinned the .NET 6 base
images it was given in 2024-03-31, so the SDK 6 image could not build a
net8.0 project:

  error NETSDK1045: The current .NET SDK does not support targeting
  .NET 8.0. [/src/SW.Mtm.Web/SW.Mtm.Web.csproj]

That is why no chart or image has been published since 6.0.9 (Feb 2026) —
`ci` fails, so `deploy` and `tag` never run. Reproduced locally byte-for-byte
against the CI log before changing anything.

- Dockerfile: aspnet 6.0 -> 8.0, sdk 6.0 -> 8.0 (match TargetFramework).
- Dockerfile: copy SW.Mtm.MsSql.csproj into the pre-restore layer. It is a
  ProjectReference of SW.Mtm.Web but was never copied, so restore logged
  "Skipping project ... because it was not found" and the layer resolved an
  incomplete graph. Now 0 skip warnings.
- ci-cd.yml: dotnet-version 6.0.x -> 8.0.x. Currently masked — there is no
  global.json, so the runner's newest preinstalled SDK is selected and the
  nuget job passes anyway — but the pin contradicts the projects and would
  break the moment a global.json is added.

NOT bumping to 9.0 (Dependabot #117/#118). Verified empirically: sdk:9.0 +
aspnet:9.0 BUILDS successfully and then fails at startup with
"You must install or update .NET to run this application. Framework:
'Microsoft.NETCore.App', version '8.0.0'" — .NET roll-forward does not
cross major versions by default. Those PRs would ship a green build and a
crash-looping image. They should be closed, or the projects retargeted to
net9.0 first.

Verified: build fails before / succeeds after; the resulting image starts
under the .NET 8 runtime and reaches application code (it then fails only
on database connectivity, with no database configured locally).

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VHkpqv6dB6wjALyFe9ocMU
@coderabbitai

coderabbitai Bot commented Aug 31, 2026

Copy link
Copy Markdown

Warning

Review limit reached

Next included review available in 19 minutes.

View limit details

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Repository: simplify9/coderabbit/.coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: b7497cf1-1510-4440-a341-ffb57ca1d757

📥 Commits

Reviewing files that changed from the base of the PR and between 3996cba and 5f86f50.

📒 Files selected for processing (2)
  • .github/workflows/ci-cd.yml
  • Dockerfile

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@MusaMisto
MusaMisto merged commit e4bcd08 into main Aug 31, 2026
5 checks passed
MusaMisto added a commit that referenced this pull request Aug 31, 2026
Regression from the .NET 8 base-image bump (#127). The runtime images
changed their default listening port between majors:

  aspnet:6.0  ASPNETCORE_URLS=http://+:80        -> listens on 80
  aspnet:8.0  ASPNETCORE_HTTP_PORTS=8080         -> listens on 8080

The chart hardcodes containerPort 80 and the Service targets the named
"http" port, so after the bump the app listened on 8080, the Service had no
reachable endpoint, and the gateway answered 503 from envoy.

It failed silently: the chart ships probes.enabled=false, so with no
readiness probe the pod still reported 1/1 Ready while serving nothing.
Deployment, Service, EndpointSlice, HTTPRoute and TLS all looked correct --
only an actual request over the wire showed it.

Setting ASPNETCORE_HTTP_PORTS=80 restores the 6.0 behaviour exactly, so the
chart, the Service and all six releases keep working with no chart change.
It stays overridable per-deployment.

Verified A/B against a real PostgreSQL, no port env override, exactly as the
cluster runs them:
  ghcr.io/simplify9/mtm:8.0.2  curl :80 -> connection reset (nothing bound)
  this build                    curl :80 -> HTTP 404 (app responding)


Claude-Session: https://claude.ai/code/session_01VHkpqv6dB6wjALyFe9ocMU

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.

1 participant