TodoApi icon indicating copy to clipboard operation
TodoApi copied to clipboard

Add docker-compose project to run all apps

Open luizfdsilva opened this issue 2 years ago • 8 comments

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.

image

luizfdsilva avatar Nov 30 '22 00:11 luizfdsilva

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.Targets a 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 avatar Nov 30 '22 00:11 davidfowl

@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.Targets a 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.

luizfdsilva avatar Nov 30 '22 04:11 luizfdsilva

This is looking pretty good! A few more questions!

davidfowl avatar Nov 30 '22 07:11 davidfowl

You know I'm going to ask you to also do the same for tye.yml when you're done 😉

davidfowl avatar Nov 30 '22 07:11 davidfowl

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.

cwe1ss avatar Nov 30 '22 08:11 cwe1ss

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!

luizfdsilva avatar Nov 30 '22 09:11 luizfdsilva

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.

luizfdsilva avatar Nov 30 '22 09:11 luizfdsilva

@cwe1ss @davidfowl I've removed the docker files and updated the docker-compose to run both images created via dotnet publish.

luizfdsilva avatar Nov 30 '22 10:11 luizfdsilva

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 :(

baronfel avatar Nov 30 '22 21:11 baronfel

@cwe1ss @davidfowl I finished all the pending changes. Please let me know if you are okay with the PR as it is now.

luizfdsilva avatar Dec 01 '22 22:12 luizfdsilva

Amazing changes. Thanks @LuizFDS !

davidfowl avatar Dec 02 '22 04:12 davidfowl