microsoft / microsoft/aspire

Dockerfile support for multiple build contexts

Open
#14,888 0 comments 0 reactions 0 assignees View on GitHub
area-app-model area-orchestrator
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.

I am trying to include a Dockerfile that uses multiple build contexts. I am usually able to build this by adding a `--build-context` argument to the `build` command line, but there is no support for this in Aspire.

Example:
```
builder.AddDockerfile("container1", "../service1")
```

See also: [Dockerfiles now Support Multiple Build Contexts](https://www.docker.com/blog/dockerfiles-now-support-multiple-build-contexts/)

### Describe the solution you'd like

The ability to add additional build contexts when adding a Dockerfile resource:

Example:
```
builder
.AddDockerfile("container1", "../service1")
.WithBuildContext("mysecondcontext", "../shared")
```

Contributor guide

Open the contributing guide

Research direction

Start at the AddDockerfile entry point and trace how its build command is assembled. Compare that flow with Docker's multiple build-context support and determine how the proposed WithBuildContext API should be represented and forwarded. Done means an added context such as "mysecondcontext" is accepted when adding a Dockerfile resource and reaches the Docker build command.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, dockerfile
Domain
build-system, devops
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.