Refactor how version numbers are specified after the introduction of installer stages
- Dominant language
- Dockerfile
- Stars
- 4.9k
- Forks
- 2k
- Avg merge
- 1d 14h
- Merged PRs (30d)
- 26
Description
Now that [every Dockerfile is utilizing an installer stage](https://github.com/dotnet/dotnet-docker/pull/6245), consider changing how the .NET version numbers are being handled.
Current Pattern (.NET version is being specified in multiple places):
```Dockerfile
ARG REPO=mcr.microsoft.com/dotnet/runtime-deps
# Installer image
FROM amd64/buildpack-deps:noble-curl AS installer
# Retrieve .NET Runtime
RUN dotnet_version=10.0.0-preview.1.25080.5 \
&& curl -fSL --output dotnet.tar.gz https://ci.dot.net/public/Runtime/$dotnet_version/dotnet-runtime-$dotnet_version-linux-x64.tar.gz \
...
# .NET runtime image
FROM $REPO:10.0.0-preview.1-noble-amd64
# .NET Runtime version
ENV DOTNET_VERSION=10.0.0-preview.1.25080.5
```
Proposal (Central the .NET version number):
```Dockerfile
ARG REPO=mcr.microsoft.com/dotnet/runtime-deps
ARG DOTNET_VERSION=10.0.0-preview.1.25080.5
# Installer image
FROM amd64/buildpack-deps:noble-curl AS installer
ARG DOTNET_VERSION
# Retrieve .NET Runtime
RUN curl -fSL --output dotnet.tar.gz https://ci.dot.net/public/Runtime/${DOTNET_VERSION}/dotnet-runtime-$dotnet_version-linux-x64.tar.gz \
...
# .NET runtime image
FROM $REPO:10.0.0-preview.1-noble-amd64
ARG DOTNET_VERSION
# .NET Runtime version
ENV DOTNET_VERSION=${DOTNET_VERSION}
```
Improves readability and maintainability of the Dockerfiles which is a benefit to the maintainers of this repo as well as customers who copy the Dockerfiles which is sometimes necessary when they can't make use of the .NET images themselves.
Contributor guide
Assessment
This issue has not been assessed yet.