-
Notifications
You must be signed in to change notification settings - Fork 8k
Update dotnetcore.md #10902
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
Update dotnetcore.md #10902
Conversation
Adding an example for .Net Core docker files as consumed by build agents and recommended by Microsoft best practices.
|
✔️ Deploy preview for docsdocker ready! 🔨 Explore the source changes: 45d4bb9 🔍 Inspect the deploy logs: https://app.netlify.com/sites/docsdocker/deploys/5fcf5f6d107c7c000786930c 😎 Browse the preview: https://deploy-preview-10902--docsdocker.netlify.app |
|
Hi @avichalchum, Thanks for your proposal. The Dockerfile you propose is indeed simpler, but it assumes the application is already build by some external tool. The simpler Dockerfile you propose could make the dev feedback loop quicker, but if you want to use this after you build your app in Visual Studio, you might as well run the app directly from visual studio for the quickest dev feedback loop, no need for an additional Dockerfile for this purpose. |
|
Hi @gtardif , Thank you for your feedback. My proposal was more around the build once, reuse multiple places principal and not for faster dev feedback. You're right, for a faster dev feedback, Visual Studio would be the fastest. But if the same code artifacts are being used by multiple docker files and especially if the code build takes a long time (assuming greater than 15 minutes), then rather than build it for each dockerfile every time, the prod deploy CI tools will build the artifacts once and use those for the various dockerfiles. Additionally, most production pipeline CI's could be running static/dynamic code analysis, vulnerability analysis, e.t.c. after the code is built by the pipeline, so building it again inside the dockerfile would then be redundant and add time. I believe it is due to these reasons Microsoft also proposes a similar dockerfile: [https://docs.microsoft.com/en-us/dotnet/core/docker/build-container?tabs=windows#create-the-dockerfile](Microsoft dockerfile example). Please note than I am proposing replacing the build steps inside a dockerfile to that outside. I am proposing providing both methods, a user who wishes to build the code inside the dockerfile can use method 1 and a user who is using it as a part of the CI can use method 2. |
gtardif
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @avichalchum,
Thanks, I see your point. We also see a lot of projects where it's better to build as much as possible inside containers, to reduce installed tooling on CI machines and make build more reproducible, make it easier to maintain build tool versions, etc.
I suggest we simply change the wording for your proposed method
Co-authored-by: Guillaume Tardif <guillaume.tardif@gmail.com>
|
@gtardif thanks. I agree with your proposed wording and have accepted that. |
Adding an example for .Net Core docker files as consumed by build agents and recommended by Microsoft best practices.
Proposed changes
Changing .Net Core example documentation to add an example that includes best practices by Microsoft for CI builds.
Unreleased project version (optional)
Related issues (optional)