Skip to content
This repository was archived by the owner on Feb 13, 2019. It is now read-only.

Conversation

@AlexChesser
Copy link
Contributor

...with unchanged dependencies.

The reason we copy the project.json first is related to the way that
Docker's "union file system" works. Each command in sequence gets cached
on the docker host as a binary. Commands that are "unchanged" from the
previous run will not be run a second time.

By changing the order here, docker's "restart" of a container will only
run a full nuget restore when a project's dependencies change, as opposed
to when any code changes at all.

@spboyer
Copy link
Contributor

spboyer commented Jan 20, 2016

@AlexChesser do you have metrics before / after ?

@AlexChesser
Copy link
Contributor Author

@spboyer I do!

I talked about it in summary over here: #527.
I also posted the FULL LOG of the difference over here: aspnet/aspnet-docker#123

old-speed: ~3m30s
happens every deploy & first deploy under new method
Start: 06:03:13.313
Finish: 06:06:40.640

new-speed: ~9s
(happens on "second deploy" if dependencies are unchanged)
Start: 06:00:36:036
Finish: 06:00:45:045

@mixxorz
Copy link

mixxorz commented Jan 30, 2016

👍 This leverages Docker caching. Though, we might need to copy the project.lock.json file as well.

@AlexChesser
Copy link
Contributor Author

@mixxorz In my tests, that didn't seem to be required. Based on what I think the .lock.json file is, I don't think it could have an impact (how could a generated dependency tree change if the versions of the source packages don't change)

It might be worth asking @DamianEdwards what project.lock.json is for and if we need to copy it over (or should do for best practice)

I'm certainly not an expert on exactly what project.lock.json is used for and how it might change.

Over time on a long running project I assumed it was 100% deterministic based on project.json

@DamianEdwards
Copy link

@glennc is best to ask what is appropriate from a Docker perspective.

@AlexChesser
Copy link
Contributor Author

@spboyer, @peterblazejewicz - any thoughts on whether we can merge this?
I think it really improves the dev & build process.

Let me know if there's anything else I need to do.

@peterblazejewicz
Copy link
Member

I've added a link to talk with video that discusses how to improve Docker experience when working with ASP.NET 5 (Core 1) projects:
792c47c
I'd opt to have the same Dockerifle as used on aspnet/home repo as explained already (so this project does not have to explain and document its content).
But I do understand the PR intent fully. The @spboyer should have something to say here, and let him decide.
Thanks!

@AlexChesser
Copy link
Contributor Author

Oh! Excellent Feedback, thanks Peter!
I agree completely so I should try and make the same PR to the aspnet/home repo.

@peterblazejewicz
Copy link
Member

@AlexChesser

May I close this? Two reasons:

  1. the RC2 implementation for Docker is greatly changed:
    https://github.com/OmniSharp/generator-aspnet/blob/master/templates/Dockerfile.txt
  2. people now actively provides derivatives to microsoft/dotnet image and discuss benefits of cached packages on slack channels, e.g.:
    https://aspnetcore.slack.com/archives/docker/p1465951626000041

Thanks!

@AlexChesser
Copy link
Contributor Author

@peterblazejewicz I agree with your reasoning, this should be closed.

Thanks for the head up!

@peterblazejewicz
Copy link
Member

@AlexChesser Thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants