mvt icon indicating copy to clipboard operation
mvt copied to clipboard

Docker improvements (multistage builds, separate os images, and more)

Open scribblemaniac opened this issue 1 year ago • 0 comments

This PR makes several improvements to using mvt with Docker:

  • Create two new Dockerfiles: Dockerfile.ios and Dockerfile.android which only contain the tools necessary for working with their respective device OSes. These images have mvt_ios/mvt_android as their entrypoint so that it does not need to be specified. The plain Dockerfile continues to have tools for both OSes and a shell entrypoint.
  • The iOS and combined Dockerfiles now use multi-stage builds. This allows Docker to parallelize parts of the build and improve layer caching. It has also been written so that the tools required only for building the dependencies are not included in the final docker image (ex. gcc, -dev libraries).
  • Fix libimobiledevicebuild build step. libimobiledevice now requires libtatsu in order to be built, so a step was added to build this new library from source.
  • Switch from a Debian to Python+Alpine for the base image of the OS-specific images. The combined image continues to use Debian, primarily for compatibility with previous image versions and ease-of-use from the shell.
  • Modify existing labels to use OCI keys, and added a few more labels.

These changes result in improved build times and 40-85% smaller images. Here's the final image sizes in my testing: Current latest image: 790 MB New combined image: 482MB New iOS image: 119 MB New Android image: 331 MB

Several smaller changes were also made such as using apt-get instead of apt for a stable CLI, ARG instead of ENV for DEBIAN_FRONTEND=noninteractive to avoid polluting the images environment, and using make -j to parallelize builds. Also fixes #360 and closes #381.

scribblemaniac avatar Jul 03 '24 22:07 scribblemaniac