Last active
March 24, 2023 18:15
-
-
Save lbussell/a10deb1370004f845332dcb47cd0b5f3 to your computer and use it in GitHub Desktop.
aspnet composite dockerfile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Installer image | |
FROM amd64/buildpack-deps:bookworm-curl AS installer | |
# Retrieve .NET Runtime | |
RUN aspnetcore_version=8.0.0-preview.3.23170.14 \ | |
&& curl -fSL --output dotnet.tar.gz https://dotnetbuilds.azureedge.net/public/aspnetcore/Runtime/$aspnetcore_version/aspnetcore-runtime-composite-$aspnetcore_version-linux-x64.tar.gz \ | |
&& dotnet_sha512='06a24a0992645757e471d6bd6244328e9f0a352ad198697c97136c997f5bfcc6b947f2e896dc3bd69590781a1befc0ec5531859b4e25456b97a24320bcacd42a' \ | |
&& echo "$dotnet_sha512 dotnet.tar.gz" | sha512sum -c - \ | |
&& mkdir -p /dotnet \ | |
&& tar -oxzf dotnet.tar.gz -C /dotnet \ | |
&& rm dotnet.tar.gz | |
# .NET runtime image | |
FROM mcr.microsoft.com/dotnet/nightly/runtime-deps:8.0.0-preview.3-bookworm-slim-amd64 AS aspnet-composite | |
# .NET Runtime version | |
ENV DOTNET_VERSION=8.0.0-preview.3.23170.2 | |
# ASP.NET Core version | |
ENV ASPNET_VERSION=8.0.0-preview.3.23170.14 | |
COPY --from=installer ["/dotnet", "/usr/share/dotnet"] | |
RUN ln -s /usr/share/dotnet/dotnet /usr/bin/dotnet | |
FROM aspnet-composite | |
ENV \ | |
# Do not generate certificate | |
DOTNET_GENERATE_ASPNET_CERTIFICATE=false \ | |
# Do not show first run text | |
DOTNET_NOLOGO=true \ | |
# SDK version | |
DOTNET_SDK_VERSION=8.0.100-preview.3.23173.11 \ | |
# 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-Debian-12 | |
RUN apt-get update \ | |
&& apt-get install -y --no-install-recommends \ | |
curl \ | |
git \ | |
wget \ | |
&& rm -rf /var/lib/apt/lists/* | |
# Install .NET SDK | |
RUN curl -fSL --output dotnet.tar.gz https://dotnetbuilds.azureedge.net/public/Sdk/$DOTNET_SDK_VERSION/dotnet-sdk-$DOTNET_SDK_VERSION-linux-x64.tar.gz \ | |
&& dotnet_sha512='cc3bb3b9f83554d83b6cad58ad1b15afae14bed6866774777f77f4d7f5e2776c5adaac5c694af0f7223e91fe13f53d72153b0d07500c9335d9f6d0c4147d0745' \ | |
&& echo "$dotnet_sha512 dotnet.tar.gz" | sha512sum -c - \ | |
&& mkdir -p /usr/share/dotnet \ | |
&& tar -oxzf dotnet.tar.gz -C /usr/share/dotnet ./packs ./sdk ./sdk-manifests ./templates ./LICENSE.txt ./ThirdPartyNotices.txt \ | |
&& rm dotnet.tar.gz \ | |
# Trigger first run experience by running arbitrary cmd | |
&& dotnet help |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment