Advice on how to reduce this image size?

Preface: I'm not a ML engineer.

I'm trying to deploy a deep learning model behind a prediction endpoint by wrapping it in a simple Flask API and dockerizing the whole thing. I have the ML model ready, and I've found a docker image with all of the dependencies installed. Problem is, that image is 8GB.

Here's the Dockerfile for the image with dependencies installed.

Can you kind folks help me reduce the image size? I figure it can be done either by 1) merging as many of the RUN statements as possible, or 2) doing a multi-stage build by somehow finding all dependencies on the filesystem and copying those across

Alternatively, should I just suck it up and accept that deep learning docker images are going to be huge no matter what?

submitted by /u/General_Example
[link] [comments]
Source: Reddit