magicpak is a command-line utility that analyzes and bundles runtime dependencies of the executable. magicpak basically collects all shared object dependencies that are required by a dynamic linker at runtime. Additionally, magicpak's contributions are summarized as follows:
Simple. You can build a minimal image just by adding a few lines to your Dockerfile.
Full-featured. You can bundle, test, and compress your executable at once. You can focus on your business because magicpak handles all Dockerfile-specific matters to decrease image size.
Dynamic analysis. --dynamic flag enables a dynamic analysis that can discover dependencies other than dynamically linked libraries.
Flexible. We expose a full control of resulting bundle with a family of options like --include and --exclude. You can deal with dependencies that cannot be detected automatically.
Stable. We don't parse undocumented and sometimes inaccurate ldd(1) outputs. Instead, we use dlopen(3) and dlinfo(3) in glibc to query shared library locations to ld.so(8).
magicpak is especially useful when you find it difficult to produce a statically linked executable. Also, magicpak is powerful when building from source is bothering or the source code is not public, because magicpak only requires the executable to build a minimal docker image.