dotnet / dotnet/sdk

Add `dotnet new` template for `.dockerignore` file

Open
#51,129 3 comments 6 reactions 0 assignees View on GitHub
Area-Templates
Dominant language
C#
Stars
3.2k
Forks
1.3k
PR merge metrics
PR metrics pending

Description

### Is your feature request related to a problem? Please describe.

When buliding a .NET Dockerfile, there are some directories that you should not copy into the Dockerfile's build context.
Currently, the best thing to do is visit the [dotnet-docker samples](https://github.com/dotnet/dotnet-docker/blob/main/samples/aspnetapp/.dockerignore) and copy a known-good `.dockerignore` file from there.

### Describe the solution you'd like

.NET should have a `.dockerignore` template built in. You should be able to run `dotnet new dockerignore` just like you run `dotnet new gitignore` in a new solution.

While this wouldn't make a difference for the SDK container publish feature, it would improve the UX when using Dockerfiles directly.

### Additional context

Related: https://github.com/dotnet/sdk/issues/16784#issuecomment-844594906

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.