Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 3 commits into from
Sep 30, 2024

Conversation

scribblemaniac
Copy link
Contributor

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.

Also made the following other changes:
- The final image for the tool-specific Dockerfiles is based off of
  alpine instead of ubuntu
- Add step to build libtatsu, which is a new dependency for
  libimobiledevice
- Multithread make operations during build
- Use ARG instead of ENV for build environment variables
- Use apt-get instead of apt
- Use non-dev library in the final image (except for manually built libraries)
This works without [usb] in Debian, but not in Alpine for some
reason.
@DonnchaC
Copy link
Collaborator

Hi @scribblemaniac. Thank you for working to improve the Docker files and for your patience until we have had time to review. The new approach you have taken looks much cleaner and should be maintainable going forward.

FYI the Java ABE tooling is no longer necessary as MVT should generate a valid non-compressed backup which can be decrypted with ABE.

Many thanks!

@DonnchaC DonnchaC merged commit f8e2b09 into mvt-project:main Sep 30, 2024
@scribblemaniac
Copy link
Contributor Author

Well, I'm glad it got merged eventually. 👌

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Docker build on 2.3.0 - warnings about Empty continuation line found
2 participants