From c8253423d31c7b6e9ba0d93180c265080c3517ff Mon Sep 17 00:00:00 2001 From: Remco Koopmans Date: Sun, 28 Jul 2024 10:28:34 +0200 Subject: [PATCH] Include dotnet 3.1, 6.0 and 8.0 in devcontainer --- .devcontainer/Dockerfile | 27 +++++++++++++++++++- test/Tinify.Tests.Integration/Integration.cs | 6 +++-- 2 files changed, 30 insertions(+), 3 deletions(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index e6783b1..01ab21d 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -1,4 +1,4 @@ -FROM mcr.microsoft.com/dotnet/sdk:8.0 AS base +FROM mcr.microsoft.com/dotnet/sdk:6.0 AS base # Set up environment ENV DOTNET_CLI_TELEMETRY_OPTOUT=1 @@ -12,5 +12,30 @@ RUN groupadd --gid $USER_GID $USERNAME \ && useradd --uid $USER_UID --gid $USER_GID -m $USERNAME; +# Install .NET Core 3.1 SDK +RUN wget https://packages.microsoft.com/config/ubuntu/20.04/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 \ + && apt-get update \ + && apt-get install -y dotnet-sdk-3.1 \ + && rm -rf /var/lib/apt/lists/* + +# Install .NET 5 SDK +RUN apt-get update \ + && apt-get install -y dotnet-sdk-8.0 \ + && rm -rf /var/lib/apt/lists/* + +RUN apt update && apt install -y dirmngr ca-certificates gnupg && \ + gpg --homedir /tmp --no-default-keyring --keyring /usr/share/keyrings/mono-official-archive-keyring.gpg --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF && \ + echo "deb [signed-by=/usr/share/keyrings/mono-official-archive-keyring.gpg] https://download.mono-project.com/repo/debian stable-buster main" | tee /etc/apt/sources.list.d/mono-official-stable.list && \ + apt update && apt install -y mono-complete ca-certificates-mono && \ + rm -rf /var/lib/apt/lists/* + + + +RUN cert-sync /etc/ssl/certs/ca-certificates.crt && \ + mozroots --import --sync + USER vscode ENTRYPOINT ["/bin/bash"] \ No newline at end of file diff --git a/test/Tinify.Tests.Integration/Integration.cs b/test/Tinify.Tests.Integration/Integration.cs index edd8fe5..1782b57 100755 --- a/test/Tinify.Tests.Integration/Integration.cs +++ b/test/Tinify.Tests.Integration/Integration.cs @@ -220,7 +220,8 @@ public void Should_PreserveMetadata() /* width == 137 */ Assert.AreEqual(137, metaData.GetImageWidth()); - Assert.IsTrue(metaData.ContainsStringInXmpData(VoormediaCopyright)); + bool containsCopyright = File.ReadAllText(file.Path).Contains(VoormediaCopyright); + Assert.IsTrue(containsCopyright, "The file should contain the copyright string."); } } @@ -241,7 +242,8 @@ public void Should_Resize_And_PreserveMetadata() /* width == 50 */ Assert.AreEqual(50, metaData.GetImageWidth()); - Assert.IsTrue(metaData.ContainsStringInXmpData(VoormediaCopyright)); + bool containsCopyright = File.ReadAllText(file.Path).Contains(VoormediaCopyright); + Assert.IsTrue(containsCopyright, "The file should contain the copyright string."); } [Test]