0

Each time I build Dockerfile with ASP.NET Core application it's download assemblies from web Nuget store.

Basically I'd like to create docker image with all this ASP.NET Core libraries (and probably some libraries I usually use).

From my understanding I trying to reinvent GAC.

So, my question is it possible to use something like GAC for ASP.NET Core? Or, my second thought, download ASP.NET Core libraries to container and then resolve it locally somehow.

My goal is to reduse time for building docker container.

UPDATE

Looks like it's impossible

3 Answers 3

5

For ASP.NET core just use dnu to build your application into a self-contained folder.

dnu publish 

will output build the project and output it to /bin/output. There are a number of options at your disposal including the ability to specify the output path, choose framework or runtime and even to change the command for starting the web.

dnu publish --help

will give you more detail on that.

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks. It's not exactly what I try to do. In this case I need to copy to container about 500 mb for simple webapp. And I want to copy only my application, so everything like framework should be in another container layer.
@VadimSentyaev: This framework does not work like the old .NET framework. It is not installed globally to the machine; it runs from a folder. All applications, including webapps, will need to have the framework local to a given path. This means that if you take the route of trying to separate the framework from the app then you're going to have to manage paths from the parent container and access them from your application layer. It is quite a bit of undue work for yourself when Microsoft has already solved this for you. This is exactly why publish exists.
3

There is now an official .NET Core Docker image from Microsoft, with all the needed libraries.

You can get it here:

https://hub.docker.com/r/microsoft/aspnetcore/

If you need to customize it, don't forget you can modify the container and create a custom image with "docker commit".

Comments

2

If you want to contain a "package" (folder) that contains your application, its dependencies and the runtime then you have to run:

dnu publish --runtime <active/runtime name> [--no-source]

The --no-source option compiles everything and increases the startup time but removes the ability to change the code in the container.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.