-
Notifications
You must be signed in to change notification settings - Fork 3
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
fix(docker): reduce size of image by about half #381
base: develop
Are you sure you want to change the base?
Conversation
It would be ideal if some build tool could minify the dependencies and only include what is needed, like vite does for the frontend. But that's not super needed, and I think requires quite a lot more changes. |
@SuperVK we could switch to vite? |
1d665ac
to
73d4385
Compare
I don't really follow why this reduces the size of the image, probably because you do |
During the Ubuntu Summit I was lead down a rabbit hole of inspecting docker images. I noticed that the sudosos-backend could use some improvement.
Description
I noticed that the npm ci still installed dev dependencies in the runtime container, so that was fixed. Furthermore when installing npm packages, it also adds to the cache. Meaning it used to have 2x the node_modules installed in the image. By installing in the build container and copying to the runtime container, we circumvent this issue.
The build from 6 days ago is the current develop docker image, the docker image from 9 minutes ago is this the one that has the improvement.
Here you can see the cache being added which is about the same size as the node_modules themself:
My improved image is currently running on develop (28-10-2024 10:53), it seems to work, only the pdf is broken, but pretty sure that has always been broken on develop?
Related issues/external references
Types of changes