Skip to content

Instantly share code, notes, and snippets.

@pellared
Last active February 3, 2021 14:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pellared/e33a8f9724cee63c023f43b158542f78 to your computer and use it in GitHub Desktop.
Save pellared/e33a8f9724cee63c023f43b158542f78 to your computer and use it in GitHub Desktop.
.NET 5 SDK Docker container with more runtimes
FROM mcr.microsoft.com/dotnet/sdk:5.0
# Install Mono slim verion
# https://github.com/mono/docker
ENV MONO_VERSION 6.12.0.107
RUN apt-get update \
&& apt-get install -y --no-install-recommends gnupg dirmngr \
&& rm -rf /var/lib/apt/lists/* \
&& export GNUPGHOME="$(mktemp -d)" \
&& gpg --batch --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF \
&& gpg --batch --export --armor 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF > /etc/apt/trusted.gpg.d/mono.gpg.asc \
&& gpgconf --kill all \
&& rm -rf "$GNUPGHOME" \
&& apt-key list | grep Xamarin \
&& apt-get purge -y --auto-remove gnupg dirmngr
RUN echo "deb http://download.mono-project.com/repo/debian stable-buster/snapshots/$MONO_VERSION main" > /etc/apt/sources.list.d/mono-official-stable.list \
&& apt-get update \
&& apt-get install -y mono-runtime \
&& rm -rf /var/lib/apt/lists/* /tmp/*
# Instructions to install .NET Core runtimes from
# https://docs.microsoft.com/en-us/dotnet/core/install/linux-package-manager-debian10
RUN wget https://packages.microsoft.com/config/debian/10/packages-microsoft-prod.deb -O packages-microsoft-prod.deb && \
dpkg -i packages-microsoft-prod.deb && \
apt-get update && apt-get install -y \
apt-transport-https \
aspnetcore-runtime-2.1 \
aspnetcore-runtime-3.0 \
aspnetcore-runtime-3.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment