fix(docker-compose): extend YAML marshaler of service.dependsOn
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/tag Build is passing

The current implementation of the method DependsOnContainer.MarshalYAML()
transform the short syntax into the long syntax. More about booth version
types of depends_on is described here:

- https://docs.docker.com/reference/compose-file/services/#short-syntax-1
- https://docs.docker.com/reference/compose-file/services/#long-syntax-1

Other applications are not compatible with the long syntax. For this reason the
MarshalYAML method has been adapted to take care of the specific syntax.

As documented of the long syntax, `depends_on.<dependency>.condition: service_started`
is the same as `depends_on: [ 'dependency' ]`, the long syntax will be shortened
when no other condition type of a dependency is specified.
This commit is contained in:
2025-03-04 17:42:07 +01:00
parent ed7622a34f
commit 3c56ae6e5e
13 changed files with 162 additions and 2 deletions

View File

@ -0,0 +1,6 @@
services:
frontend:
depends_on:
backend:
condition: service_completed_successfully
image: library/frontend:latest

View File

@ -0,0 +1,3 @@
services:
backend:
image: library/backend:latest

View File

@ -0,0 +1,8 @@
services:
backend:
image: library/backend:latest
frontend:
depends_on:
backend:
condition: service_completed_successfully
image: library/frontend:latest