McCloudS / subgen

Autogenerate subtitles using OpenAI Whisper Model via Jellyfin, Plex, Emby, Tautulli, or Bazarr
MIT License
532 stars 48 forks source link

Optimize image recreation by caching pip install #12

Closed pearlythepirate closed 10 months ago

pearlythepirate commented 10 months ago

I noticed when iterating through install configs on my machine that the Dockerfile pulled ~4.5GB of dependencies every time the container was restarted. These changes cache the pip dependencies into the image during build instead of at runtime.

McCloudS commented 10 months ago

I'm deciding if I want to revert or not, because the image is ballooning to ~4.5GB vs the ~150mb it was and just have people store dependencies in a volume mount if they don't want to deal with the re-download. The times of the push to dockerhub are longer too, about 13 minutes vs 90 seconds.

Keeping it without reverting would prevent version issues potentially between the dependencies, whereas the smaller image would be pulling new packages on every new run/install.

Thoughts?

pearlythepirate commented 10 months ago

Hmmm good points. There is probably a smarter way to write the dockerfile. I noticed the ${APPDATA}/subgen/dist-packages:/usr/local/lib/python3.10/dist-packages bind but disregarded it at the time.

If we can have the user store the package downloads in a volume or bind mount that the installer can check and then use without downloading them each time is probably a better option. I'll tweak a couple things and re-submit.