Hacker News new | past | comments | ask | show | jobs | submit login
Push Docker image from specific sub-directory
3 points by summerborn 28 days ago | hide | past | favorite | 6 comments
We have a huge monorepo (built using NodeJS). We have application drivers with the name: Validator, Reader, etc. inside of the monorepo. Each of those application drivers are sub-directory. We also have a private Docker Hub account where the entire monorepo is pushed as Docker image. Is it possible to push each sub-directory as docker image and not as a whole? How do we go about with it. By the way, the source code is in Bitbucket.



What would be your final purpose with this? Slim the image down? Hoping to have a better CI/CD strategy if split it in multiple images? Anyways, I have a hunch that this will be solved only by having an architectural revamp of the app, try to design it in such a way that it will work as multiple smaller services interacting together as a whole (micro-services).

Also, Docker Compose doesn't really help you with this. It only helps you with "syncing" the components of your app together, but since you don't have the components of it yet running as separate images / containers, it's pointless, at least at this time.


Well, I hope to use each of those images from sub directory as a Kubernetes container.


Not trying to sound condescending, but do you have any working knowledge of containers?

That's why I said you need to go revamp the design of your app first, going from a "monolithic design" to a close-knitted, loosely-coupled "microservice-based design":

- split the functions of your app into pieces, do that on paper - draw the interaction between all of those components with arrows, to see the inter-dependencies, see what functions need to read/write from a database and which need to poll another function for checking the state. - read a bit about sharding (both app and database). - start "breaking" the above functions into separate entities, containerize them (see what runtime you need, what extra libs, what OS would you prefer in case you need to troubleshoot, make sure you won't have a multi-gigabyte image, optimize as much as you can, you can do it later but you won't, let's be honest, that's how technical debt comes into play) and try to have them play nice with each other.

When you managed to do that, try to use docker-compose and do some testing, to see how the performance is doing, bugfix, do some more testing, then some more bugfixing afterwards and then, when you're happy with what you have, read about Kubernetes / Openshift / EKS / AKS and do an analysis on what you need from a container orchestration system, have some requirements then compare those with all the above examples I've wrote and get the right mix of cost per functionality.

I can't really recommend any reading for it, there are a lot of resources on Google for the theoretical stuff, but to put them in practice, either bring in someone experienced from outside your organization (if that person doesn't exist inside of it) or try to put together an innovation team that'll do this, but with a lot of "trial and error" sprinkled all over it.


OK. Looks like I did not make my question clear, sir. Here is the thing: 1. I have a huge monorepo for the backend, written in NodeJS and Express. I have used Bitbucket (Git) for VC. Inside that monorepo, there are 5 application drivers. Those drivers perform their own unique tasks. i. Validator - validates txs ii. writer, etc. You probably got it I'm sure.

Now, I have written the CI/CD pipe already. I have a private Docker Hub repo. There in, I have pushed that entire monorepo from Bitbucket. The bitbucket-pipelines.yml file is written for the whole monorepo and not for individual applications drivers that I mentioned above. Now, there is Docker Image for that entire repo. The thing is, in the private Docker Hub repo, I want to store them as separate images - inside that single repo, because right now, I can't separately access them. Those 5 of them I mean. However, I can't separate those drivers as micro-services of their own ( I mean in separate repo because they share NGINX, mongodb, logdna, etc).

My question is: 1. Is it possible | logical to write 'Dockerfile' inside each application driver and would that suffice me to see them as separate images inside the Docker Hub repo? 2. Or is there any other way I could do it? 3. Can I use docker-compose.yml file which is available for the monorepo as a whole to connect those drivers ( using the Dockerfile inside each of them?)

Thank You.


Looks like you need the docker-compose.


Does each of those drivers/sub-directory applications require their own Dockerfile first?




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: