Skip to content

Refactor how version numbers are specified after the introduction of installer stages #6266

@MichaelSimons

Description

@MichaelSimons

Now that every Dockerfile is utilizing an installer stage, consider changing how the .NET version numbers are being handled.

Current Pattern (.NET version is being specified in multiple places):

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):

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.

Metadata

Metadata

Assignees

Projects

  • Status

    Sprint

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions