Repository navigation
docker: trim the arm64 MySQL tarball install to what the server runs - #46
Merged
Merged
Conversation
On arm64 the MySQL flavors install from Oracle's aarch64 tarball, which is a full distribution rather than a server package. It carries a debug build of mysqld, the MeCab dictionaries, the static client libraries, and the headers and manual pages, and its mysqld is unstripped where the .deb packages the other architectures install ship a stripped one. Drop the four and strip mysqld in the layer that unpacked them, so the arm64 image carries the same payload the .deb flavors already produce. Deleting them from a later layer would not help: the layer that unpacked them is already in the download. /usr/local goes from 1.7G to 546M, and mysqld from 491M to 61M, against 69M for the stripped .deb build on amd64. binutils is installed for strip and purged with --auto-remove, leaving the package set unchanged.
There was a problem hiding this comment.
🟡 Changes recommended
Removing MySQL’s bundled MeCab configuration and dictionaries breaks parser initialization for consumers using those assets, preventing use of indexes declared with WITH PARSER mecab.
1 open issue
What changed in this PR
This PR reduces the arm64 MySQL payload in Vitess Docker images by trimming Oracle’s tarball installation in the same layer where it is unpacked.
Changes:
- Adds cleanup limited to arm64
mysql80andmysql84, removing selected bundled files and strippingmysqld. - Temporarily installs
binutilsfor stripping, then purges it. - Runs cleanup before deleting apt package lists, leaving other architectures and flavors unchanged.
| File | Description |
|---|---|
docker/utils/install_dependencies.sh |
Adds architecture- and flavor-specific tarball trimming to the existing cleanup phase. |
Review effort: Balanced
morgo
approved these changes
Nov 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
On arm64 the
mysql80andmysql84flavors install MySQL from Oracle's aarch64 tarball, because Oracle's Debian repo publishes no arm64.debfor them. That tarball is a full distribution, not a server package, so the arm64 vttestserver image carries roughly a gigabyte that a server never runs.This trims it to what the
.debflavors already produce on the other architectures.What changes
docker/utils/install_dependencies.shgrows atrim_mysql_tarball_install, called from the existing cleanup section. It returns immediately unless the build is arm64 onmysql80ormysql84, so no other flavor or architecture is touched. Every image that runs this script on those flavors gets the trim, sodocker/liteanddocker/minishrink on arm64 along with vttestserver.It removes four things the tarball ships and the image does not use, and strips
mysqld:/usr/local/bin/mysqld/usr/local/bin/mysqld-debug/usr/local/lib/mecab/usr/local/lib/*.a/usr/local/include,/usr/local/man/usr/localtotalStripping is not a new risk: on amd64 the
.debmysqldis already stripped, at 69M against this 61M.stripleaves.dynsymalone, so plugins still resolve.binutilsis installed for the strip and purged with--auto-remove; the resulting package set is identical to today's, verified withdpkg-query -Wagainst the published image.Why it has to happen here
Docker layers are additive, so this only works in the layer that unpacked the tarball. A consumer that deletes these files in its own
FROMlayer still downloads them.That is why the fix belongs in this script rather than in the images built on top of it.
Testing
The trim was built for real:
vttestserver/Dockerfile.mysql84's runtime stage, built on arm64 from this branch, so the files are removed in the layer that unpacked them. Built from the same Dockerfile without the trim, the image is 4.33GB; with it, 2.48GB.mysqld --versionstill reports8.4.8, andmysqld --initialize, startup, DDL and DML, andmysqladmin shutdownall work.dpkg-query -Wreturns a package set identical to the published24.0.5-block.2-mysql84image's, so purgingbinutilsleaves nothing behind and takes nothing with it./usr/local/binis intact apart frommysqld-debug.mysqladminin particular survives, whichmysqlctl shutdownfalls back to when no shutdown hook is configured.The trim is subtractive rather than a copy-forward of a chosen set, which is what keeps a binary like
mysqladminfrom going missing by omission.The
mysql80arm64 path takes the same branch but was not built here.This workflow builds both architectures on a pull request touching
docker/utils/**, so the amd64 leg covers the untouched path and the arm64 leg builds the change itself.