### Installer Stage Setup Source: https://github.com/dotnet/dotnet-docker/blob/main/tests/Microsoft.DotNet.Docker.Tests/Baselines/GeneratedArtifactTests/VerifyInternalDockerfilesOutput/runtime-deps-8.0-cbl-mariner2.0-amd64-Dockerfile.approved.txt Sets up an intermediate 'installer' stage to install shadow-utils, which are needed for user management, and cleans up the package cache. ```Dockerfile FROM base AS installer RUN tdnf install -y \ shadow-utils \ && tdnf clean all ``` -------------------------------- ### Final ASP.NET Composite Image Setup Source: https://github.com/dotnet/dotnet-docker/blob/main/tests/Microsoft.DotNet.Docker.Tests/Baselines/GeneratedArtifactTests/VerifyInternalDockerfilesOutput/aspnet-8.0-jammy-chiseled-composite-amd64-Dockerfile.approved.txt Sets environment variables for .NET and ASP.NET versions, copies the installed runtime and symlink from the installer stage, and sets the entrypoint and default command. ```Dockerfile # ASP.NET Composite Image FROM $REPO:0.0.0-jammy-chiseled-amd64 ENV \ # .NET Runtime version DOTNET_VERSION=0.0.0 \ # ASP.NET Core version ASPNET_VERSION=0.0.0 COPY --from=installer ["/usr/share/dotnet", "/usr/share/dotnet"] COPY --from=installer ["/dotnet-symlink", "/usr/bin"] ENTRYPOINT ["/usr/bin/dotnet"] CMD ["--info"] ``` -------------------------------- ### Final .NET Runtime Image Setup Source: https://github.com/dotnet/dotnet-docker/blob/main/tests/Microsoft.DotNet.Docker.Tests/Baselines/GeneratedArtifactTests/VerifyInternalDockerfilesOutput/runtime-8.0-cbl-mariner2.0-distroless-extra-amd64-Dockerfile.approved.txt Copies the installed .NET runtime and the 'dotnet' symlink from the installer stage into the final distroless image. Sets the entrypoint to 'dotnet' and the default command to '--info'. ```Dockerfile FROM $REPO:0.0.0-cbl-mariner2.0-distroless-extra-amd64 # .NET Runtime version ENV DOTNET_VERSION=0.0.0 COPY --from=installer ["/usr/share/dotnet", "/usr/share/dotnet"] COPY --from=installer ["/dotnet-symlink", "/usr/bin"] ENTRYPOINT ["/usr/bin/dotnet"] CMD ["--info"] ``` -------------------------------- ### Final .NET Runtime Image Setup Source: https://github.com/dotnet/dotnet-docker/blob/main/tests/Microsoft.DotNet.Docker.Tests/Baselines/GeneratedArtifactTests/VerifyInternalDockerfilesOutput/runtime-10.0-azurelinux3.0-distroless-extra-amd64-Dockerfile.approved.txt Copies the installed .NET runtime and the symlinked dotnet executable from the installer stage into the final runtime image. Sets the entrypoint and default command. ```Dockerfile COPY --from=installer ["/usr/share/dotnet", "/usr/share/dotnet"] COPY --from=installer ["/dotnet-symlink", "/usr/bin"] ENTRYPOINT ["/usr/bin/dotnet"] CMD ["--info"] ``` -------------------------------- ### Dockerfile Setup for .NET SDK Source: https://github.com/dotnet/dotnet-docker/blob/main/tests/Microsoft.DotNet.Docker.Tests/Baselines/GeneratedArtifactTests/VerifyInternalDockerfilesOutput/sdk-10.0-noble-aot-amd64-Dockerfile.approved.txt This snippet defines the base image and installs essential development tools and libraries. It ensures a clean state by removing apt cache after installation. ```dockerfile ARG REPO=mcr.microsoft.com/dotnet/sdk FROM $REPO:0.0.0-noble-amd64 RUN apt-get update \ && apt-get install -y --no-install-recommends \ clang \ llvm \ zlib1g-dev \ && rm -rf /var/lib/apt/lists/* ``` -------------------------------- ### Final .NET Runtime Image Setup Source: https://github.com/dotnet/dotnet-docker/blob/main/tests/Microsoft.DotNet.Docker.Tests/Baselines/GeneratedArtifactTests/VerifyInternalDockerfilesOutput/runtime-8.0-azurelinux3.0-distroless-amd64-Dockerfile.approved.txt Copies the installed .NET runtime from the installer stage and the symlinked dotnet executable to their final locations in the distroless image. Sets the entrypoint to the dotnet executable. ```dockerfile COPY --from=installer ["/usr/share/dotnet", "/usr/share/dotnet"] COPY --from=installer ["/dotnet-symlink", "/usr/bin"] ``` ```dockerfile ENTRYPOINT ["/usr/bin/dotnet"] CMD ["--info"] ``` -------------------------------- ### Configure SDK Image and Install Tools Source: https://github.com/dotnet/dotnet-docker/blob/main/tests/Microsoft.DotNet.Docker.Tests/Baselines/GeneratedArtifactTests/VerifyInternalDockerfilesOutput/sdk-9.0-azurelinux3.0-arm64v8-Dockerfile.approved.txt Sets up the final SDK image with environment variables for .NET and installs git and libgcc-atomic. It then copies the installed SDK from the installer stage. ```Dockerfile # .NET SDK image FROM $REPO:0.0.0-azurelinux3.0-arm64v8 ENV \ # Do not generate certificate DOTNET_GENERATE_ASPNET_CERTIFICATE=false \ # Do not show first run text DOTNET_NOLOGO=true \ # SDK version DOTNET_SDK_VERSION=0.0.0 \ # Enable correct mode for dotnet watch (only mode supported in a container) DOTNET_USE_POLLING_FILE_WATCHER=true \ # Skip extraction of XML docs - generally not useful within an image/container - helps performance NUGET_XMLDOC_MODE=skip \ # PowerShell telemetry for docker image usage POWERSHELL_DISTRIBUTION_CHANNEL=PSDocker-DotnetSDK-Azure-Linux-3.0-arm64 RUN tdnf install -y \ git \ libgcc-atomic \ tar \ && tdnf clean all COPY --from=installer ["/dotnet", "/usr/share/dotnet"] # Trigger first run experience by running arbitrary cmd RUN dotnet help ``` -------------------------------- ### Final ASP.NET Composite Image Setup Source: https://github.com/dotnet/dotnet-docker/blob/main/tests/Microsoft.DotNet.Docker.Tests/Baselines/GeneratedArtifactTests/VerifyInternalDockerfilesOutput/aspnet-10.0-azurelinux3.0-distroless-composite-extra-arm64v8-Dockerfile.approved.txt Sets environment variables for .NET and ASP.NET versions, copies the runtime from the installer stage, and configures the entrypoint and default command. ```Dockerfile FROM $REPO:0.0.0-azurelinux3.0-distroless-extra-arm64v8 ENV \ # .NET Runtime version DOTNET_VERSION=0.0.0 \ # ASP.NET Core version ASPNET_VERSION=0.0.0 COPY --from=installer ["/usr/share/dotnet", "/usr/share/dotnet"] COPY --from=installer ["/dotnet-symlink", "/usr/bin"] ENTRYPOINT ["/usr/bin/dotnet"] CMD ["--info"] ``` -------------------------------- ### ASP.NET Composite Image Setup Source: https://github.com/dotnet/dotnet-docker/blob/main/tests/Microsoft.DotNet.Docker.Tests/Baselines/GeneratedArtifactTests/VerifyInternalDockerfilesOutput/aspnet-8.0-noble-chiseled-composite-extra-arm64v8-Dockerfile.approved.txt This stage sets environment variables for the .NET and ASP.NET Core versions. It then copies the installed runtime from the 'installer' stage and makes the dotnet executable available in the system's PATH by copying it to /usr/bin. The ENTRYPOINT is set to the dotnet executable, with a default CMD to display version information. ```Dockerfile # ASP.NET Composite Image FROM $REPO:0.0.0-noble-chiseled-extra-arm64v8 ENV # .NET Runtime version DOTNET_VERSION=0.0.0 # ASP.NET Core version ASPNET_VERSION=0.0.0 COPY --from=installer ["/usr/share/dotnet", "/usr/share/dotnet"] COPY --from=installer ["/dotnet-symlink", "/usr/bin"] ENTRYPOINT ["/usr/bin/dotnet"] CMD ["--info"] ``` -------------------------------- ### Final ASP.NET Composite Image Setup Source: https://github.com/dotnet/dotnet-docker/blob/main/tests/Microsoft.DotNet.Docker.Tests/Baselines/GeneratedArtifactTests/VerifyInternalDockerfilesOutput/aspnet-9.0-azurelinux3.0-distroless-composite-amd64-Dockerfile.approved.txt Sets environment variables for .NET and ASP.NET Core versions. Copies the installed runtime and symlink from the installer stage into the final image. Sets the entrypoint to dotnet and the default command to --info. ```Dockerfile FROM $REPO:0.0.0-azurelinux3.0-distroless-amd64 ENV \ # .NET Runtime version DOTNET_VERSION=0.0.0 \ # ASP.NET Core version ASPNET_VERSION=0.0.0 COPY --from=installer ["/usr/share/dotnet", "/usr/share/dotnet"] COPY --from=installer ["/dotnet-symlink", "/usr/bin"] ENTRYPOINT ["/usr/bin/dotnet"] CMD ["--info"] ``` -------------------------------- ### Dockerfile Setup for .NET SDK Source: https://github.com/dotnet/dotnet-docker/blob/main/tests/Microsoft.DotNet.Docker.Tests/Baselines/GeneratedArtifactTests/VerifyInternalDockerfilesOutput/sdk-9.0-azurelinux3.0-aot-amd64-Dockerfile.approved.txt This snippet defines the base image and installs necessary build tools like build-essential and clang. It cleans up the package cache afterwards. ```docker # syntax=docker/dockerfile:1 ARG REPO=mcr.microsoft.com/dotnet/sdk FROM $REPO:0.0.0-azurelinux3.0-amd64 RUN tdnf install -y \ build-essential \ clang \ zlib-devel \ && tdnf clean all ``` -------------------------------- ### Final Runtime Image Setup Source: https://github.com/dotnet/dotnet-docker/blob/main/tests/Microsoft.DotNet.Docker.Tests/Baselines/GeneratedArtifactTests/VerifyInternalDockerfilesOutput/runtime-9.0-azurelinux3.0-distroless-arm64v8-Dockerfile.approved.txt Copies the installed .NET runtime and the symlinked dotnet executable into the final runtime image. Sets the entrypoint and default command. ```Dockerfile FROM $REPO:0.0.0-azurelinux3.0-distroless-arm64v8 # .NET Runtime version ENV DOTNET_VERSION=0.0.0 COPY --from=installer ["/usr/share/dotnet", "/usr/share/dotnet"] COPY --from=installer ["/dotnet-symlink", "/usr/bin"] ENTRYPOINT ["/usr/bin/dotnet"] CMD ["--info"] ``` -------------------------------- ### Final ASP.NET Composite Image Setup Source: https://github.com/dotnet/dotnet-docker/blob/main/tests/Microsoft.DotNet.Docker.Tests/Baselines/GeneratedArtifactTests/VerifyInternalDockerfilesOutput/aspnet-10.0-alpine3.22-composite-amd64-Dockerfile.approved.txt This stage sets the DOTNET_VERSION and ASPNET_VERSION environment variables. It then copies the installed .NET runtime from the installer stage and creates a symbolic link for the dotnet executable. ```Dockerfile # ASP.NET Composite Image FROM $REPO:0.0.0-alpine3.XX-amd64 ENV \ # .NET Runtime version DOTNET_VERSION=0.0.0 \ # ASP.NET Core version ASPNET_VERSION=0.0.0 COPY --from=installer ["/dotnet", "/usr/share/dotnet"] RUN ln -s /usr/share/dotnet/dotnet /usr/bin/dotnet ``` -------------------------------- ### Install .NET SDK from Archive Source: https://github.com/dotnet/dotnet-docker/blob/main/tests/Microsoft.DotNet.Docker.Tests/Baselines/GeneratedArtifactTests/VerifyInternalDockerfilesOutput/sdk-10.0-alpine3.23-arm64v8-Dockerfile.approved.txt Installs the .NET SDK by downloading a tarball, verifying its integrity using SHA512, and extracting it to the /dotnet directory. This process is part of the 'installer' build stage. ```Dockerfile RUN dotnet_sdk_version=0.0.0 \ && dotnet_sdk_build_version=$dotnet_sdk_version \ && wget --header "Authorization: Bearer $ACCESSTOKEN" --header "x-ms-version: 2017-11-09" \ https://dotnetstage.blob.core.windows.net/Sdk/$dotnet_sdk_build_version/dotnet-sdk-$dotnet_sdk_build_version-linux-musl-arm64.tar.gz \ https://dotnetstage.blob.core.windows.net/Sdk/$dotnet_sdk_build_version/dotnet-sdk-$dotnet_sdk_build_version-linux-musl-arm64.tar.gz.sha512 \ && echo "$(cat dotnet-sdk-$dotnet_sdk_build_version-linux-musl-arm64.tar.gz.sha512) dotnet-sdk-$dotnet_sdk_build_version-linux-musl-arm64.tar.gz" | sha512sum -c - \ && mkdir --parents /dotnet \ && tar --gzip --extract --no-same-owner --file dotnet-sdk-$dotnet_sdk_build_version-linux-musl-arm64.tar.gz --directory /dotnet ./dnx ./packs ./sdk ./sdk-manifests ./templates ./LICENSE.txt ./ThirdPartyNotices.txt \ && rm \ dotnet-sdk-$dotnet_sdk_build_version-linux-musl-arm64.tar.gz \ dotnet-sdk-$dotnet_sdk_build_version-linux-musl-arm64.tar.gz.sha512 ``` -------------------------------- ### Install System Packages and Copy SDK Source: https://github.com/dotnet/dotnet-docker/blob/main/tests/Microsoft.DotNet.Docker.Tests/Baselines/GeneratedArtifactTests/VerifyInternalDockerfilesOutput/sdk-11.0-alpine3.23-arm64v8-Dockerfile.approved.txt Installs essential system packages like curl, git, and ICU, then copies the installed .NET SDK from the installer stage into the final image. ```Dockerfile # .NET SDK image FROM $REPO:0.0.0-alpine3.XX-arm64v8 RUN apk add --upgrade --no-cache \ curl \ git \ icu-data-full \ icu-libs \ libatomic \ tzdata COPY --from=installer ["/dotnet", "/usr/share/dotnet"] ``` -------------------------------- ### Configure .NET SDK Environment and Install PowerShell Source: https://github.com/dotnet/dotnet-docker/blob/main/tests/Microsoft.DotNet.Docker.Tests/Baselines/GeneratedArtifactTests/VerifyInternalDockerfilesOutput/sdk-11.0-azurelinux3.0-arm64v8-Dockerfile.approved.txt Sets environment variables for the .NET SDK, installs git and libgcc-atomic, copies the SDK from the installer stage, creates a symlink for dnx, and installs the PowerShell global tool. ```Dockerfile # .NET SDK image FROM $REPO:0.0.0-azurelinux3.0-arm64v8 ENV \ # Do not generate certificate DOTNET_GENERATE_ASPNET_CERTIFICATE=false \ # Do not show first run text DOTNET_NOLOGO=true \ # SDK version DOTNET_SDK_VERSION=0.0.0 \ # Enable correct mode for dotnet watch (only mode supported in a container) DOTNET_USE_POLLING_FILE_WATCHER=true \ # Skip extraction of XML docs - generally not useful within an image/container - helps performance NUGET_XMLDOC_MODE=skip \ # PowerShell telemetry for docker image usage POWERSHELL_DISTRIBUTION_CHANNEL=PSDocker-DotnetSDK-Azure-Linux-3.0-arm64 \ # Workaround for https://github.com/PowerShell/PowerShell/issues/20685 DOTNET_ROLL_FORWARD=Major RUN tdnf install -y \ git \ libgcc-atomic \ tar \ && tdnf clean all COPY --from=installer ["/dotnet", "/usr/share/dotnet"] RUN ln -s /usr/share/dotnet/dnx /usr/bin/dnx \ # Trigger first run experience by running arbitrary cmd && dotnet help # Install PowerShell global tool RUN powershell_version=0.0.0 \ && curl --fail --show-error --location --output PowerShell.Linux.arm64.$powershell_version.nupkg https://powershellinfraartifacts-gkhedzdeaghdezhr.z01.azurefd.net/tool/$powershell_version/PowerShell.Linux.arm64.$powershell_version.nupkg \ && powershell_sha512='{sha512_placeholder}' \ && echo "$powershell_sha512 PowerShell.Linux.arm64.$powershell_version.nupkg" | sha512sum -c - \ && mkdir --parents /usr/share/powershell \ && dotnet tool install --add-source / --tool-path /usr/share/powershell --version $powershell_version PowerShell.Linux.arm64 \ && dotnet nuget locals all --clear \ && rm PowerShell.Linux.arm64.$powershell_version.nupkg \ && ln -s /usr/share/powershell/pwsh /usr/bin/pwsh \ && chmod 755 /usr/share/powershell/pwsh \ # To reduce image size, remove the copy nupkg that nuget keeps. && find /usr/share/powershell -print | grep -i '.*[.]nupkg$' | xargs rm ``` -------------------------------- ### Install Base Packages and Copy SDK Source: https://github.com/dotnet/dotnet-docker/blob/main/tests/Microsoft.DotNet.Docker.Tests/Baselines/GeneratedArtifactTests/VerifyInternalDockerfilesOutput/sdk-9.0-azurelinux3.0-amd64-Dockerfile.approved.txt Installs essential packages like git and tar, cleans up package manager cache, and copies the .NET SDK from the installer stage into the final image. ```Dockerfile RUN tdnf install -y \ git \ libgcc-atomic \ tar \ && tdnf clean all COPY --from=installer ["/dotnet", "/usr/share/dotnet"] ``` -------------------------------- ### Run Sample Image Source: https://github.com/dotnet/dotnet-docker/blob/main/samples/dotnetapp/README.md Launches a pre-built sample .NET application image from the container registry. ```console docker run --rm mcr.microsoft.com/dotnet/samples:dotnetapp-chiseled ``` -------------------------------- ### ASP.NET Core Image Setup Source: https://github.com/dotnet/dotnet-docker/blob/main/tests/Microsoft.DotNet.Docker.Tests/Baselines/GeneratedArtifactTests/VerifyInternalDockerfilesOutput/aspnet-10.0-noble-chiseled-arm64v8-Dockerfile.approved.txt This section sets the ASP.NET Core version and copies the installed runtime from the installer stage into the final chiseled image. ```Dockerfile # ASP.NET Core image FROM $REPO:0.0.0-noble-chiseled-arm64v8 # ASP.NET Core version ENV ASPNET_VERSION=0.0.0 COPY --from=installer ["/dotnet", "/usr/share/dotnet"] ``` -------------------------------- ### Final ASP.NET Core Image Setup Source: https://github.com/dotnet/dotnet-docker/blob/main/tests/Microsoft.DotNet.Docker.Tests/Baselines/GeneratedArtifactTests/VerifyInternalDockerfilesOutput/aspnet-8.0-azurelinux3.0-amd64-Dockerfile.approved.txt Sets the ASP.NET Core version environment variable and copies the installed runtime from the installer stage into the final image. ```dockerfile # ASP.NET Core image FROM $REPO:0.0.0-azurelinux3.0-amd64 # ASP.NET Core version ENV ASPNET_VERSION=0.0.0 COPY --from=installer ["/dotnet", "/usr/share/dotnet"] ``` -------------------------------- ### Dockerfile Instructions for SDK Setup Source: https://github.com/dotnet/dotnet-docker/blob/main/tests/Microsoft.DotNet.Docker.Tests/Baselines/GeneratedArtifactTests/VerifyInternalDockerfilesOutput/sdk-8.0-noble-aot-amd64-Dockerfile.approved.txt This snippet defines the Dockerfile's build arguments, base image, and copies custom apt sources. It's used to establish the initial environment for the SDK. ```dockerfile # syntax=docker/dockerfile:1 ARG REPO=mcr.microsoft.com/dotnet/sdk FROM $REPO:0.0.0-noble-amd64 COPY <