AVRO-4272: Modernize share/docker/Dockerfile with BuildKit and reduce image size#3826
Open
iemejia wants to merge 1 commit into
Open
AVRO-4272: Modernize share/docker/Dockerfile with BuildKit and reduce image size#3826iemejia wants to merge 1 commit into
iemejia wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Pull request overview
This PR modernizes the Avro build Docker image to leverage Docker BuildKit features (cache/bind mounts) while trimming installed packages to reduce image size and improve rebuild speed. It also adjusts Python packaging metadata and dependency locking for the Python implementation.
Changes:
- Updated
share/docker/Dockerfileto use BuildKit cache/bind mounts, trim apt packages, and reorder language/tool installs for better caching. - Updated Python packaging metadata in
lang/py/pyproject.tomland bumped the mypy upper bound inlang/py/uv.lock.
Reviewed changes
Copilot reviewed 2 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| share/docker/Dockerfile | BuildKit cache/bind mounts, package trimming, install flow changes for faster rebuilds/smaller layers. |
| lang/py/pyproject.toml | Python packaging metadata tweaks (license files path, setuptools package discovery). |
| lang/py/uv.lock | Updates the mypy version constraint upper bound. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
ccf34e5 to
e72b198
Compare
e72b198 to
56992a8
Compare
56992a8 to
089bb88
Compare
089bb88 to
18add2b
Compare
18add2b to
aba71ca
Compare
… image size Use BuildKit cache mounts (--mount=type=cache) for apt, npm, cpanm, and bundler. Eliminates repeated apt-get update/clean cycles, produces smaller layers, and speeds up rebuilds. Use bind mounts for Ruby gem resolution, replacing COPY layers. Add # syntax=docker/dockerfile:1 directive for portability. Replace libboost-all-dev (~70+ sub-packages) with the four Boost packages actually needed by the C++ test suite: libboost-dev, libboost-test-dev, libboost-random-dev, libboost-math-dev. Remove redundant packages provided by build-essential (g++, gcc, make) or by other -dev packages (libsnappy1v5). Remove apt-transport-https (unnecessary on Ubuntu 24.04). Add --no-install-recommends to all apt-get install calls. Add php-zip and unzip (previously pulled as recommends, needed by Composer). Move libbz2-dev and libzstd-dev from PHP section to main packages. Move libyaml-dev from Ruby section to main packages. Remove Rust toolchain (no longer needed). Fix .NET SDK install to use && instead of ; (fail-fast on errors). Convert build-only variables (MAVEN_VERSION, APACHE_DIST_URLS, PHP8_VERSION) from ENV to ARG. Remove dead PIP_NO_CACHE_DIR=off (misleading and moot with uv). Move Ruby bundle install after .NET/Java layers for better cache efficiency. Fix PHP extension build to use /tmp/lang/php (consistent naming, proper cleanup). Requires Docker BuildKit (default builder since Docker 23.0). Assisted-by: GitHub Copilot:claude-opus-4.6
aba71ca to
6d1676f
Compare
Comment on lines
+109
to
+112
| curl -fsSL -o /tmp/nodesource_setup.sh https://deb.nodesource.com/setup_24.x \ | ||
| && bash /tmp/nodesource_setup.sh \ | ||
| && rm /tmp/nodesource_setup.sh \ | ||
| && apt-get -qqy install --no-install-recommends nodejs \ |
Comment on lines
+206
to
+208
| && curl -fsSL -o /tmp/uv-install.sh https://astral.sh/uv/0.11.23/install.sh \ | ||
| && sh /tmp/uv-install.sh \ | ||
| && rm /tmp/uv-install.sh |
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
Modernize the Docker build image (
share/docker/Dockerfile) to leverage BuildKit features, reduce image size, and improve rebuild speed.Changes
BuildKit cache mounts
# syntax=docker/dockerfile:1directive for portability--mount=type=cachefor apt, npm, cpanm, and bundler caches — eliminates repeatedapt-get update/apt-get cleancycles, produces smaller layers, and speeds up rebuilds--mount=type=bindfor Ruby gem resolution (replacesCOPYlayers)Package trimming
libboost-all-dev(~70+ sub-packages) with only the four Boost packages needed by the C++ test suite:libboost-dev,libboost-test-dev,libboost-random-dev,libboost-math-devbuild-essential(g++,gcc,make) or by other -dev packages (libsnappy1v5)apt-transport-https(unnecessary on Ubuntu 24.04)--no-install-recommendsto allapt-get installcallsphp-zipandunzip(previously pulled as recommends, needed by Composer)tmuxto ease interactive work inside the container (e.g. running multiple build/test sessions in parallel)Housekeeping
MAVEN_VERSION,APACHE_DIST_URLS,PHP8_VERSION) fromENVtoARGPIP_NO_CACHE_DIR=off(misleading and moot withuv)&&instead of;(fail-fast on errors)/tmp/lang/php(consistent naming, proper cleanup)bundle installafter .NET/Java layers for better cache efficiencylibbz2-dev,libzstd-dev,libyaml-devto main packages sectionPython packaging fix (
lang/py/pyproject.toml)license-filespath to point toavro/LICENSE(actual location)[tool.setuptools.packages.find]withinclude = ["avro*"]to ensure correct package discovery<2.2.0inuv.lockRequirements
Requires Docker BuildKit (default builder since Docker 23.0).