Multiple -f#116
Conversation
Signed-off-by: Josh Curl <hello@joshcurl.com>
|
I don't think this handles merge the same way as compose. For one, it needs to merge |
|
@dnephin If |
|
@joshwget I like the approach, took me a bit to notice you are storing @dnephin Is the merging behavior of extends documented? From what I understand of this PR is if you do |
|
That sounds right |
|
@dnephin I think that addresses all of your original comments then, but please let me know if I missed something! |
Signed-off-by: Josh Curl <hello@joshcurl.com>
|
@joshwget According to the documentaiton compose looks by default for |
Signed-off-by: Josh Curl <hello@joshcurl.com>
|
Thanks @vdemeester, should be addressed now! |
|
Hum… doesn't seem to work as expected, I'm using the # With docker-compose
$ docker-compose -f docker-compose.yml -f compose2.yml up -d
Creating multiplecomposefiles_simple_1
Creating multiplecomposefiles_yetanother_1
Creating multiplecomposefiles_another_1
$ docker-compose -f docker-compose.yml -f compose2.yml ps
Name Command State Ports
-----------------------------------------------------------
multiplecomposefiles_another_1 top Up
multiplecomposefiles_simple_1 top Up
multiplecomposefiles_yetanother_1 top Up
# With libcompose-cli on this PR
$ libcompose-cli -f docker-compose.yml -f compose2.yml up -d
WARN[0000] Note: This is an experimental alternate implementation of the Compose CLI (https://github.com/docker/compose)
INFO[0000] Project [multiple-composefiles]: Starting project
INFO[0000] [0/1] [yetanother]: Starting
INFO[0000] [1/1] [yetanother]: Started
$ libcompose-cli -f docker-compose.yml -f compose2.yml ps
WARN[0000] Note: This is an experimental alternate implementation of the Compose CLI (https://github.com/docker/compose)
Name Command State Ports
multiple-composefiles_yetanother_1 top Up 29 seconds It only picked that latest one and did no merge 😅. |
Signed-off-by: Josh Curl <hello@joshcurl.com>
|
@vdemeester When I try reproducing your example I get results similar to Compose. Would you mind checking this again? 😄 |
|
@joshwget you are right, I might have messed up, it's working as expected 😝 ; with |
There was a problem hiding this comment.
I would have written like this (because I don't like else's 😝), but not sure if it's better or not...
context.ComposeFiles = c.GlobalStringSlice("file")
if len(context.ComposeFiles) == 0 {
context.ComposeFiles = []string{"docker-compose.yml"}
if _, err := os.Stat("docker-compose.override.yml"); err == nil {
context.ComposeFiles = append(context.ComposeFiles, "docker-compose.override.yml")
}
}There was a problem hiding this comment.
I'm not sure we should do this check, docker-compose will fail if we manage to specify an empty compose file :
$ libcompose-cli -f ../ports-composefile/docker-compose.yml -f "" up -d
WARN[0000] Note: This is an experimental alternate implementation of the Compose CLI (https://github.com/docker/compose)
INFO[0000] Project [ports-composefile]: Starting project
INFO[0000] [0/1] [simple]: Starting
INFO[0000] [1/1] [simple]: Started
$ docker-compose -f ../ports-composefile/docker-compose.yml -f "" up -d
ERROR: .IOError: [Errno 21] Is a directory: u'./'|
@joshwget So far, so good 😉. Few commands on code but it almost work as expected, that's cool 👍 😉. I would add more integration test though :
|
|
/ping @joshwget |
Fixes #98. This changes some properties of
Context(string ComposeFileto[]string ComposeFilesand[]byte ComposeBytesto[][]byte ComposeBytes) as well asProject(string Fileto[]string Files).Signed-off-by: Josh Curl hello@joshcurl.com