EddieHubCommunity / BioDrop

Connect to your audience with a single link. Showcase the content you create and your projects in one place. Make it easier for people to find, follow and subscribe.
https://biodrop.io
MIT License
5.73k stars 3.96k forks source link

[Enhancement] Reduce docker image size with multistage Dockerfile #8301

Closed Naresh-chandanbatve closed 1 year ago

Naresh-chandanbatve commented 1 year ago

What would you like to share?

Currently the Dockerfiles are using normal single stage concept and I have checked the current size of linkfree image is around 2 gb we can reduce the docker image size by applying multistage dockerfile concept and only copy essential files to the final stage. which will make easy for other developers to pull the image more efficiently.

multistage Dockerfile looks something like this.

Screenshot 2023-07-17 064435

It will be great if you provide some information on file changing like what is the use of Dockerfile.dev and should I change both files or only main Dockerfile.

If it is ready for dev I would like to work on this.

Additional information

No response

github-actions[bot] commented 1 year ago

To reduce notifications, issues are locked until they are https://github.com/EddieHubCommunity/LinkFree/labels/%F0%9F%8F%81%20status%3A%20ready%20for%20dev and to be assigned. You can learn more in our contributing guide https://github.com/EddieHubCommunity/LinkFree/blob/main/CONTRIBUTING.md

Pradumnasaraf commented 1 year ago

This is interesting because, technically, it's not an effective multistage build. In a multistage build, we usually build the executable and copy it to a different step just to run it without needing all the app files. However, the changes you proposed involve copying the whole app after running npm i and running it on a lighter version of Node. The same result can be achieved by simply changing the base to a lighter version of Node.

Yes, the app is bigger, but I am not keen on running it on a lighter version of (Alpine) as this is a full-stack app that uses Next.js. There are lots of weird behaviours that can happen with Alpine.

Thanks for raising. Closing this issue.