Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Image with multiple SDKs #731

Open
Kralizek opened this issue Feb 13, 2021 · 6 comments
Open

Image with multiple SDKs #731

Kralizek opened this issue Feb 13, 2021 · 6 comments

Comments

@Kralizek
Copy link

Describe the Problem

More and more CI tools like CircleCI and AWS CodeBuild are based on executing the process in containers. This works really fine when creating applications that are bound to a single target framework.

The same unfortunately can't be said when packaging a library that targets multiple frameworks, especially when executing the tests.

An example is a solution with

  • library targeting net48, netstandard2.1, net5.0
  • test project targeting net48, netcoreapp3.1, net5.0

In cases like this, you need to orchestrate a build across multiple containers. While working, you lose the advantages of having artifacts and test results coming from the same execution (this is a problem i am experiencing with CircleCI.

Describe the Solution

Ideally it would be nice if there were images that included multiple runtimes and SDKs.

Best options would be

  • an image including selected version of netfx and all netcore lts and latest current (currently 3.1 and 5.0). This image would obviously work only on windows.
  • an image including only netcore runtimes that can be used on linux

Alternatively, it would be acceptable for me if you could publish a guide with a series of concrete steps to achieve the same.

Additional Context

I was encouraged to open this issue from a conversation in Twitter: https://twitter.com/Kralizek/status/1360295293426806793

@MichaelSimons
Copy link
Member

[Triage] This topic of multi-purpose images is an interesting to us.

We could add the multiple runtimes to support this scenario. The downside is that it adds more to an already large image. We don't have a sense for how many users would make use of the multiple runtimes.

We think a multi-stage Dockerfile could be utilized here. The idea is to use different stages specific to each target framework. We would like to see someone create a proof of concept that illustrates this idea and possibly incorporate it into our samples.

@lukos
Copy link

lukos commented May 20, 2021

The most obvious way is to build out your own images with all of the targets you want installed. After reading another related issue and from my own experience, I think the problem is the number of different ways to do this and it not being clear the correct way.

For example, you can install things with chocolatey, nuget, powershell, msi etc. and the urls to obtained some of the msi's change over time.

If we could find a really consistent way to do this then the clean way would be something like:

FROM mcr.microsoft.com/dotnet/framework/sdk:4.7.2 AS base

SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop';$ProgressPreference='silentlyContinue';"]
Add-AppxPackage https://consistently.named.url/netsdk/sdk48.msix
Add-AppxPackage https://consistently.named.url/netsdk/sdknetstandard21.msix
Add-AppxPackage https://consistently.named.url/netsdk/sdk5.msix

Note that I am also opposed to just inventing another new thing that just makes all of this even more confusing!

@slonopotamus
Copy link

So, what's wrong with choco install netfx-4.7.2-devpack + <whatever else packages you need>?

@Kralizek
Copy link
Author

I guess getting where "choco install" actually works and doesn't throw an error? 🤔

@slonopotamus
Copy link

slonopotamus commented May 21, 2021

This works for me without any errors:

FROM mcr.microsoft.com/windows/servercore:20H2
# Chocolatey install command is taken from its website: https://chocolatey.org/install
RUN powershell -NoProfile -ExecutionPolicy Bypass -Command "Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))"
RUN choco install -y netfx-4.7.2-devpack

What error are you talking about?

@slonopotamus
Copy link

There's an alternative way: use VS Build Tools (or even Visual Studio) installer, since you most likely would need things like MSBuild and others from it anyway:

FROM mcr.microsoft.com/windows/servercore:20H2
ADD https://aka.ms/vs/16/release/vs_buildtools.exe C:/
RUN C:/vs_buildtools.exe --quiet --wait --nocache \
	--add Microsoft.Net.Component.4.7.2.SDK \
	--add Microsoft.Net.Component.4.7.2.TargetingPack

Refer to docs for a list of available component ids.

@mthalman mthalman moved this to Backlog in .NET Fx Docker Dec 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Backlog
Development

No branches or pull requests

5 participants