MihaMarkic / Cake.Docker

Cake AddIn that extends Cake with Docker
MIT License
47 stars 36 forks source link

Support Docker Compose V2 #115

Open sonnguyent2 opened 9 months ago

sonnguyent2 commented 9 months ago

Currently DockerComposeBuild still use Compose V1 instead of V2. It requires to install docker-compose package. Do you have any plan to migrate to Compose V2?

MihaMarkic commented 8 months ago

Hi @sonnguyent2, I've switched to compose, do you mind give it a try at https://github.com/MihaMarkic/Cake.Docker/tree/feature/compose2 or I could create a prerelease package for you.

sonnguyent2 commented 8 months ago

Hi @MihaMarkic thanks for your response, I have tried to build the code but get this error: src\Cake.Docker.Tests\Compose\Ps\DockerComposePsTest.cs(13,58): error CS0117: 'DockerComposePsSettings' does not contain a definition for 'Filters'. In the DockerComposePsSettings, there is an Filter property but not Filters , could you please double check ?

MihaMarkic commented 8 months ago

@sonnguyent2 I see, fixed. It should compile now.

sonnguyent2 commented 8 months ago

@MihaMarkic yes, its compiled but still got error. Root cause come from the order of command arguments. This command built by ProcessArgumentBuilder: docker compose build --file docker-compose.yml will not work because --file is not argument of build command, instead it is compose's argument https://docs.docker.com/engine/reference/commandline/compose/

This command will work: docker compose --file docker-compose.yml build I managed to make it work by update GenericDockerRunner but it's just a temp solution. For the permanent solution, looking forward to hearing from you.

MihaMarkic commented 8 months ago

@sonnguyent2 Hm, good catch, I guess. I have to verify, but I suppose you are correct. Also I wouldn't expect that orders of arguments matter.

MihaMarkic commented 8 months ago

@sonnguyent2 Can you try with latest sources? Commit: 0bcf83c

MihaMarkic commented 8 months ago

Note: I've separated the two settings into DockerComposeSettings and command specific one.

silex-victor commented 2 months ago

Hi,

Any news on this ?

According to this issue it seems the standalone docker-compose (aka v1) is being retired from ubuntu runners starting this month and we are already seeing runners without it.

I'd be happy to help.

Best Regards,

MihaMarkic commented 2 months ago

@silex-victor I created a commit and asked you to give it a try - see a my answer above...

silex-victor commented 2 months ago

(Just for the record i was not the original other of this issue)

I'm unable to make it work with the sources from the branch you mentionned and be able to reference the sources / nupkg from our build.cake file, is there documentation somwhere on how to achieve this ?

If it's easy on your side, could you publish a prerelease build from your branch (as mentionned in this comment so I could test it on my side and come back to you ?

Best Regards,

silex-victor commented 2 months ago

Ok so it seems I was able to make it work referencing the dll itself by using #reference "Dlls/Cake.Docker.dll" (built from the branch feature/compose2) and it seems to be working fine, but I'm unsure of my process.

MihaMarkic commented 1 month ago

@silex-victor Will publish a prerelease, sorry for the delay

MihaMarkic commented 1 month ago

@silex-victor @sonnguyent2 Released in 1.4.0-beta.1, can you give it a try?