Repository navigation
Add Dockerfiles for CBL-Mariner - #2841
Conversation
| && dotnet_sha512='{{VARIABLES[cat("hostfxr-rpm|6.0|linux|", ARCH_SHORT, "|sha")]}}' \ | ||
| && echo "$dotnet_sha512 dotnet-hostfxr.rpm" | sha512sum -c - \ | ||
| \ | ||
| && curl -SL --output dotnet-runtime-deps.rpm https://dotnetcli.azureedge.net/dotnet/Runtime/$DOTNET_VERSION/dotnet-runtime-deps-$DOTNET_VERSION-cm.1-{{ARCH_SHORT}}.rpm \ |
There was a problem hiding this comment.
I was expecting to see this installed in the base runtime-deps image.
There was a problem hiding this comment.
The problem is that the RPM path is version-specific. This would prevent layer sharing by forcing us to have distinct a runtime-deps for 3.1, 5.0, and 6.0. Installation of the runtime-deps.rpm is essentially a no-op because its dependent packages are already installed from the runtime-deps base layer.
There was a problem hiding this comment.
This defeats the reason for using the package manager though. We wanted to use the package manager in order to support installing application packages that have a dependency on the .NET packages. With the proposed implementation, our runtime-deps image could not be used for application packages that have a runtime-deps dependency**.
** they could in the same way you are however if they are downloading the rpm like you are, then they would also need to download the runtime-deps which isn't a great UX.
There was a problem hiding this comment.
With the proposed implementation, our runtime-deps image could not be used for application packages that have a runtime-deps dependency
Sure it could. It's not completely optimal but I wouldn't say it's unacceptable. Let's say there's an app package with a dependency on the runtime-deps-5.0 package. And then the runtime-deps:5.0-cbl-mariner1.0 image is used as a base image. When they install the app package, it will install the runtime-deps-5.0 package (which is minimal in itself). The package manager will also resolve the runtime-deps-5.0 dependencies and see that they're already installed and install nothing more.
There was a problem hiding this comment.
Sure it could. It's not completely optimal but I wouldn't say it's unacceptable
That's what I was trying to call out in my footnote. I'm not sure it is the UX we want though. If we decide that we are going to install the packages than I lean towards we use the package manager 100%. If we want to optimize towards layer sharing, there are ways we could still achieve that and with the runtime-deps packages installed in the runtime-deps image.
There was a problem hiding this comment.
If we want to optimize towards layer sharing, there are ways we could still achieve that and with the runtime-deps packages installed in the runtime-deps image.
I'd prefer to optimize for layer sharing and still support package management. What ideas do you have for achieving this with the runtime-deps RPM file?
One way I can think of this being done is having an image hierarchy of runtime-deps between 3.1, 5.0, and 6.0. This is illustrated with the following pseudo-Dockerfiles:
3.1 Dockerfile:
FROM cblmariner.azurecr.io/base/core:1.0
RUN rpm --install dotnet-runtime-deps-3.1.16-cm.1-x64.rpm5.0 Dockerfile:
FROM mcr.microsoft.com/dotnet/runtime-deps:3.1-cbl-mariner1.0
RUN rpm --install dotnet-runtime-deps-5.0.7-cm.1-x64.rpm6.0 Dockerfile:
FROM mcr.microsoft.com/dotnet/runtime-deps:5.0-cbl-mariner1.0
RUN rpm --install dotnet-runtime-deps-6.0.0-preview.5-cm.1-x64.rpmThis works as long as the dependencies are additive with each successive .NET version; otherwise, you could end up with unneeded packages in derived images. But dependencies are pretty stable. If there ever was a case like this, we could simply split the hierarchy at the necessary version.
Given that the RPM file is versioned with each servicing release, the runtime-deps images would get rebuilt with each servicing release, which we would want to do anyway to ensure we get the latest dependent package versions. Because of the hierarchical structure described above, it actually handles preview releases well without a lot of image churn. Preview releases often occur OOB from servicing releases. And the preview images would be the last image in the hierarchy. So if we simply update the 6.0 runtime-deps Dockerfile for the preview release, it won't cause 3.1 and 5.0 runtime-deps to be rebuilt.
This is an advantage over a kitchen-sink runtime-deps file that would include all the versions:
Dockerfile (tagged as 3.1, 5.0, and 6.0):
FROM cblmariner.azurecr.io/base/core:1.0
RUN rpm --install \
dotnet-runtime-deps-3.1.16-cm.1-x64.rpm \
dotnet-runtime-deps-5.0.7-cm.1-x64.rpm \
dotnet-runtime-deps-6.0.0-preview.5-cm.1-x64.rpmThere's no image hierarchy here so a change to a 6.0 preview version would cause all the other versions to be rebuilt unnecessarily.
There was a problem hiding this comment.
I was thinking along the same lines. There were a few other maintenance unfriendly ideas that came to but I don't think they are worth discussing. I was leaning towards the multi-release Dockerfile but was thinking it would only be used for RTM versions as a way to get around the preview issue.
There was a problem hiding this comment.
I've made changes to introduce this hierarchy. For now 3.1 and 5.0 share a Dockerfile. But I've added a 6.0 Dockerfile for runtime-deps that adds the runtime-deps RPM package which is based on the 5.0 tag.
|
A resolution to the following comments are still pending: |
|
|
||
| if ($SdkVersion) { | ||
| $updateDepsArgs += @("--product-version", "sdk=$SdkVersion", "--product-version", "sdk-rpm=$SdkVersion") | ||
| $updateDepsArgs += @("--product-version", "sdk=$SdkVersion", "--product-version") |
There was a problem hiding this comment.
This change doesn't look right with the tailing "--product-version". The AspnetVersion and RuntimeVersion have a double "--product-version".
| "runtime|6.0|linux|x64|sha": "69b91743bf79f44da0bb82f9d36f77e12ef2889e11badcf096734a8c98819a79e83f9d92cbb9f82584e8062089df52db9e4675bc143fc46ed3a31029d8de6df7", | ||
| "runtime|6.0|linux|arm64|sha": "13d58229e85005ecc1e890052744b8bb3a8e1f538bbe716e9a9c4dea9a459d6bd5e7b733b2eb0b29e96d32e27eeb11f830fa7a52eac7879550e7df97ea73b90e", | ||
| "runtime|6.0|win|x64|sha": "79ec387b89400e21426493736e268ad7d4f0bdb73e1742af92623e668a34f31cd93135276e7fab436faae994d34ebd41b1d8e2a83ed8933f4f2a452362219dc5", | ||
| "runtime-apphost-pack|6.0|linux-rpm|x64|sha": "c85960f3030dcd8220dfa85be6ebe6d50e8e636d3306cc77662f1894dbce1685381f06e92b2a3203af67963d21e3f5704e34fe5c65baa684f57d7bef2746084f", |
There was a problem hiding this comment.
I like the way this turned out.
Related to #2837
In order to provide compatibility with the .NET packages that are installed from the Mariner package repository, the Dockerfiles install .NET bits via RPM packages rather than tarballs. The necessary RPMs are not yet available for 3.1 and 5.0 so this is currently only being done for the 6.0 Dockerfiles. Once 3.1 and 5.0 have builds with the necessary RPMs, those Dockerfiles will be updated.
Installing via RPM files means we need to collect checksum values for all those RPM files. This is what most of the infra changes are related to. There are a lot more parameters that are now necessary to pass to the update-dependencies tool. To simplify the dev experience, I've created a
Set-DotnetVersions.ps1PowerShell script. This is used both from the dev desktop and by the update-dependencies pipeline for the purposes of generating the command line args.