OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

How do I keep the size of my docker image down for a flask app?

  • Thread starter Thread starter not in use
  • Start date Start date
N

not in use

Guest
I am deploying my flask app to azure and it works, but the docker image is way too big (think 10GB), this is slowing the program to the point of being unusable. This is ridiculous as the program uses 2 .py files and 3 .html templates, totalling a few kbs.

What is causing the issue is my requirements doc: Flask==3.0.3 Flask-WTF==1.2.1 WTForms==3.1.2 python-docx==1.1.2 Werkzeug==3.0.3 torch==2.3.1 numpy==1.24.0 git+https://github.com/m-bain/whisperX.git@main#egg=whisperx

The whisperx function is very demanding and is why RUN /bin/sh -c pip install -r requirements.txt # buildkit is using 9.62 GB.

Is there a way to only install what I need? Im importing the entire torch library for one function (cuda.isavailable) and the entire whisperx library for only a few functions.

How can I save space so my program will run well?

Expected a reduction in file size.

Tried changing my imports to from whisperx import functionName, nextFunction didnt work because whisperx dot functionName is how functions are called and whisperx not defined.

Tried from torch import cuda but this was a waste of time because whisperx imports it all anyway.
<p>I am deploying my flask app to azure and it works, but the docker image is way too big (think 10GB), this is slowing the program to the point of being unusable. This is ridiculous as the program uses 2 .py files and 3 .html templates, totalling a few kbs.</p>
<p>What is causing the issue is my requirements doc:
<code>Flask==3.0.3 Flask-WTF==1.2.1 WTForms==3.1.2 python-docx==1.1.2 Werkzeug==3.0.3 torch==2.3.1 numpy==1.24.0 git+https://github.com/m-bain/whisperX.git@main#egg=whisperx</code></p>
<p>The whisperx function is very demanding and is why RUN /bin/sh -c pip install -r requirements.txt # buildkit is using 9.62 GB.</p>
<p>Is there a way to only install what I need? Im importing the entire torch library for one function (cuda.isavailable) and the entire whisperx library for only a few functions.</p>
<p>How can I save space so my program will run well?</p>
<p>Expected a reduction in file size.</p>
<p>Tried changing my imports to from whisperx import functionName, nextFunction
didnt work because whisperx dot functionName is how functions are called and whisperx not defined.</p>
<p>Tried from torch import cuda but this was a waste of time because whisperx imports it all anyway.</p>
 

Latest posts

J
Replies
0
Views
1
jbowerbir
J
Top