-
Notifications
You must be signed in to change notification settings - Fork 2
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
Add node base image #5
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This violates some best practices:
- Single Responsibility Principle
- Each container should only have 1 process running
- Complexity and Maintenance
- Adding an extra unnecessary layer of complexity, Kubernetes already provides an ingress.
(One process per container, Ideal node docker image)
Secondly, Node Containers should never serve static files. I'd also apply these principles to Nuxt & Laravel images.
Eg. For Nuxt there should be 2 images build from a Nuxt repo.
- Build the Nuxt Project
- Copy static files to a nginx image (devs should make sure all their static files are under
/assets
- Copy nuxt server to node image
- The ingress in kubernetes should be configured to route all calls prefixed with
/assets/
to the nginx container, all other calls should be routed to the nuxt server.
First point: No. Your articles, and every other, talk about "concerns". A single concern per app. Not a single process. The whole concern of this base image is serving the web app/api/whatever. What we're not doing is mixing this with other web apps. And that's the whole point of all those articles. Don't run your frontend and backend on the same container. Don't run your database service on the same container as your web app, etc… Concern. The combination of nginx and Node in one container is for 1 concern. Serving your API content. They don't do different things, they work as 1. Regarding complexity/maintenance:
Second point: You're making a LOT of assumptions there.
Third point you didn't cover: Reproducibility. Currently a lot of devs run stuff locally, which does not match server at all. There's a lot of differences, most related to ingress (besides services, which they can mostly simulate locally). With these base images, that include the most important bits of nginx (headers/compression/static routing), they can reproduce this all with ease locally when running in docker. Fourth point: The only point you didn't explicitly mention here (but did in discussions on Slack), is about a process dying but the container remaining alive. That is a side effect of using |
95a2384
to
6dee038
Compare
Combination of nuxt image (node stuff) and PHP image (script commands).
I'm pretty sure we can just apply this base image to all existing node projects… It's only once we update the modules to use the new ports & commands that the new stuff will be used. Note: we could (and should) create components so that we can mix the old & new stuff.