if you are deploying to a CPU inference, instead of GPU-based, then you can save a lot of space by installing PyTorch with CPU-only capabilities. That significantly reduces the docker image size (the pytorch component is ~128MB compressed.
To install CPU-only, go to https://pytorch.org 344 and in the Install selector, select the option CUDA to be None and you will get the right set of commands.