TodoApi
TodoApi copied to clipboard
Add docker-compose project to run all apps
With docker-compose we now setup it as startup project and run it from Visual Studio. It will spin up both apps todoapi and todo-web-server plus jaeger and prometheus.

I like the docker compose idea but there are a few things I don't like:
- Why is there a specific open telemetry section instead of just using the config entries for individual providers as a signal that they should be turned on?
- Why do we need 3 docker-compose.yaml, docker-compose override.yml, and docker-compose.dcproj. Can we make this work with a vanilla call to docker compose up without the VS tooling support in there?
- Why is there a new launch settings file?
- Why is
Microsoft.VisualStudio.Azure.Containers.Tools.Targetsa dependency at all? I'd like this to not be a part of the project.
Overall, I love the idea, but I'd like it to be a bit less VS specific.
@davidfowl, thanks for the inputs. Please see all my replies below.
- Why is there a specific open telemetry section instead of just using the config entries for individual providers as a signal that they should be turned on?
I've fixed it —no reason for it to be there.
- Why do we need 3 docker-compose.yaml, docker-compose override.yml, and docker-compose.dcproj. Can we make this work with a vanilla call to docker compose up without the VS tooling support in there?
Visual Studio created it. I've removed all the VS-specific ones and left a single vanilla docker-compose.yaml.
- Why is there a new launch settings file?
This one was specific for the project docker-compose.dcproj. Visual Studio treats it like a csproj file.
- Why is
Microsoft.VisualStudio.Azure.Containers.Tools.Targetsa dependency at all? I'd like this to not be a part of the project.
Removed. It was added by VS automatically when I added docker support.
This is looking pretty good! A few more questions!
You know I'm going to ask you to also do the same for tye.yml when you're done 😉
Does anyone know if it's possible to use Docker compose with the new .NET SDK integration for building docker images without a Dockerfile?
If this were possible with Docker Compose, it would maybe be great to use it here since it's so much simpler if you don't have to keep Dockerfiles up to date.
You know I'm going to ask you to also do the same for tye.yml when you're done 😉
It'll be my pleasure!
Does anyone know if it's possible to use Docker compose with the new .NET SDK integration for building docker images without a Dockerfile?
@cwe1ss Yes, it's possible. You will need to run dotnet publish --os linux --arch x64 /t:PublishContainer -c Release to build your local image first, then you can run your docker-compose file.
I might add this change to this PR.
@cwe1ss @davidfowl I've removed the docker files and updated the docker-compose to run both images created via dotnet publish.
Does anyone know if it's possible to use Docker compose with the new .NET SDK integration for building docker images without a Dockerfile?
If this were possible with Docker Compose, it would maybe be great to use it here since it's so much simpler if you don't have to keep Dockerfiles up to date.
I want to chat with the team that does the VS integration, but I think with a bit of work we could add what @LuizFDS did to the VS docker compose support. It's definitely something I've been thinking about. CLI-based compose usage will still need the explicit publish step prior to docker compose up though :(
@cwe1ss @davidfowl I finished all the pending changes. Please let me know if you are okay with the PR as it is now.
Amazing changes. Thanks @LuizFDS !