dokkaner / teemii

A versatile, self-hosted manga reader and manager with extensible agent-based metadata retrieval
https://www.teemii.io
MIT License
289 stars 17 forks source link

Multi-stage build for backend #44

Open schklom opened 8 months ago

schklom commented 8 months ago

Description

The backend Docker image is 1.49GB on my arm64 machine. I doubt the entire space is needed.

Desired Behavior

Although I don't know how to dev using npm, a quick search shows that multi-stage building the Docker image is possible: https://www.cloudnweb.dev/2019/10/crafting-multi-stage-builds-with-docker-in-node-js/

For this backend image, is something similar doable?

Additional Context

No response

Code of Conduct

dokkaner commented 8 months ago

Yes, the image size is relatively important for the Teemii backend, particularly because of the presence of Puppeteer and therefore Chromium. The Docker Files are not optimized at the moment, but I'll look into implementing your suggestion. Many Thanks!

schklom commented 8 months ago

To lighten it, you could stop embedding Puppeteer into the image, and add it as a container in the docker-compose.yml, then add a URL to it as an environment variable. Other projects such as https://github.com/dgtlmoon/changedetection.io use this service too and let the user run a dedicated Docker container for it. The benefit is that a Puppeteer container can be used by multiple other containers, instead of each one embedding a brand new Puppeteer.

dokkaner commented 8 months ago

Yes, I had actually thought about it. But for the moment I'd prefer it to be integrated and dedicated to Teemii. Because even though it would bring more flexibility, it would require more configuration and considerations during setup on the part of the user, which I don't want at the moment.