You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 8, 2020. It is now read-only.
I noticed that there was some room for improvement in the Dockerfiles created by the Yeomen generator. There are two parts to it:
Run the apt-get commands before any project-specific commands.
Copy onlyproject.json before running dotnet restore, then copy the rest before dotnet build.
The rationale for both these changes is driven by how Docker caches intermediate images in building from a Dockerfile.
I won't duplicate that explanation here, but this means that Node.js won't need to be reinstalled on every code change and project dependencies won't need to be restored unless project.json changes.
I hope you find this useful. I wouldn't have been able to get started down the ASP.Net SPA path without the generators, so keep up the great work.
EDIT: I would have also added a .dockerignore to the templates, but I'm not at all familiar with Yeomen generators and wasn't sure if it was as simple as dropping it in the right place. It's essentially the same syntax as the .gitignore. We don't want any build artifacts from the Docker host making their way into the Docker container.
Hi @aidansteele, I'm your friendly neighborhood .NET Foundation Pull Request Bot (You can call me DNFBOT). Thanks for your contribution!
In order for us to evaluate and accept your PR, we ask that you sign a contribution license agreement. It's all electronic and will take just minutes. I promise there's no faxing. https://cla2.dotnetfoundation.org.
@aidansteele, Thanks for signing the contribution license agreement so quickly! Actual humans will now validate the agreement and then evaluate the PR.
Thanks for this! It's now merged. I am a novice with Docker so I definitely appreciate your suggestion about this.
I would have also added a .dockerignore to the templates
If you can show me what you think the resulting .dockerignore files should contain (e.g., just post that into a new issue), I can update the generator code to emit them.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
None yet
3 participants
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I noticed that there was some room for improvement in the Dockerfiles created by the Yeomen generator. There are two parts to it:
apt-getcommands before any project-specific commands.project.jsonbefore runningdotnet restore, then copy the rest beforedotnet build.The rationale for both these changes is driven by how Docker caches intermediate images in building from a Dockerfile.
I won't duplicate that explanation here, but this means that Node.js won't need to be reinstalled on every code change and project dependencies won't need to be restored unless
project.jsonchanges.I hope you find this useful. I wouldn't have been able to get started down the ASP.Net SPA path without the generators, so keep up the great work.
EDIT: I would have also added a .dockerignore to the templates, but I'm not at all familiar with Yeomen generators and wasn't sure if it was as simple as dropping it in the right place. It's essentially the same syntax as the .gitignore. We don't want any build artifacts from the Docker host making their way into the Docker container.