Customize the base image for project resources
- Dominant language
- C#
- Stars
- 6.3k
- Forks
- 991
- Avg merge
- 2d 15h
- Merged PRs (30d)
- 196
Description
### Is there an existing issue for this?
- [x] I have searched the existing issues
### Is your feature request related to a problem? Please describe the problem.
It's not easily possible to customize the docker image created by `/t:PublishContainer` for project resources. For example, if you need to `apt install` some fonts, you need to take full control over the build and deploy steps.
Alternatively, you can specify a custom runtime base image, but then you need to setup the infrastructure to maintain that.
``` C#
var webapp = builder.AddProject("webapp")
.WithDockerfileBaseImage(runtimeImage: "myregistry.dev/aspnet:10.0-noble-with-extras");
```
### Describe the solution you'd like
It would be cool if you could pass in a `ContainerResource` reference to `WithDockerfileBaseImage`.
``` C#
var runtimeBase = builder.AddDockerfileBuilder("myruntimebase", "path/to/context", dockerfile =>
{
dockerfile.Builder
.From("mcr.microsoft.com/dotnet/aspnet:10.0-noble")
.Run("apt-get update && apt-get install -y fonts-dejavu && rm -rf /var/lib/apt/lists/*")
.Copy("./vendor-libs/", "/var/lib/");
});
var webapp = builder.AddProject("webapp")
.WithDockerfileBaseImage(runtimeImage: runtimeBase);
```
### Additional context
https://discord.com/channels/1361488941836140614/1442135030599123098
Contributor guide
Assessment
This issue has not been assessed yet.