-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature proposal: Services whose source/Dockerfile is not at the root of the repo #81
Comments
OK here's a quick prototype before I go to bed. I haven't tested this, manually or otherwise: https://github.com/faradayio/cage/compare/master...camjackson:repo_subdir?expand=1 |
- Relies on experimental feature here: faradayio/cage#81
Ok I've just tested this out and it actually worked, first try! 🎉 To see how this looks, here is a repo containing two services (backend/frontend), and here is a pod using the Ok so this is definitely possible, and in fact not too difficult to implement. I guess the more relevant question is whether or not it's a good idea, and if so, whether it's a sensible design. |
I think the "standard" way to handle this in dockerfile: subdir/Dockerfile It might make sense to extract In general, if there's a way to do something using standard Docker syntax, we're very happy to support it. But adding new |
Yeah I agree, adding new labels is definitely the easy way out, and not the right way when it can be avoided. I'll experiment with |
Ah, wait. It looks like It looks like we would need to figure out that syntax for in-repo paths in Git URLs, or something like that, for maximum compatibility. Maybe it's worth experimenting with |
Yeah I was coming to same conclusion about I had a pretty good look around for how to specify a subdirectory in a At the moment I'm struggling to get |
OK I found it! After digging through the source code for docker-compose, and then the underlying docker-py library, I eventually figured out that Docker itself is responsible for figuring out what to do with git URLs. So it's not actually a docker-compose-specific thing, which is why I couldn't find it previously. Anyway, the relevant docs are here. In short, the correct syntax is So with this, we could stay compatible with the underlying docker-compose/Docker configuration, and avoid adding another label. Should I go ahead and try parsing a subdirectory out of the build URL? |
Yes, this would be an excellent and 100% acceptable solution! In general, any time we can implement a feature by improving our support for Even internally at Faraday, there's a constant temptation to add one-off features to And thank you for spear-heading this! (Oh, and good news: Amazon ECS now supports Docker 17.06, which means that we can finally use |
Oh cool! I'm not using ECS for anything at the moment, but those features would definitely be useful in Cage! |
Yeah, we have a mix of ECS and Kubernetes on the backend, but we usually wait until new Docker features are deployable on ECS to really start experimenting with them. And we like to experiment with new features manually before baking them into |
Sounds like a good tag line: "Cage: Plausibly Reasonable Practices" 😆 I've made some basic progress on this. A quick question before I finish up for the night - do you think that the logic for parsing the directory from the URL belongs in compose_yml? I was going to implement it directly in cage, but it feels like maybe it should be a helper method on |
Yeah, definitely in This is another lesson we learned the hard way: It's tempting to let |
Suppose I have a project like this:
They're two 'services' which run independently of each other, each with its own source code, Dockerfile, build process etc. But because there's a high degree of coupling between them (a web frontend that consumes a RESTful API in this case), it's convenient for them to live in the same repo.
What I'd like Cage to support is:
build
field for the two of them points to the same git repocage source mount my-project
would mount the source for both services, same as the existing behaviour for services that share a reposrc/my-project/[frontend|backend]
.I can think of two ways to specify this extra piece of information:
build
as a git URL are somewhat limited, so I'm not sure whether something like this would be compatible.io.fdy.cage.srcdir
. E.g.io.fdy.cage.repo_subdir
.What do you think of this as a feature? It is a good/bad/terrible idea?
The text was updated successfully, but these errors were encountered: