perf(docker): improve pd/store/server image build cache efficiency#2981
perf(docker): improve pd/store/server image build cache efficiency#2981zeel2104 wants to merge 1 commit intoapache:masterfrom
Conversation
There was a problem hiding this comment.
Pull request overview
Improves Docker build cache reuse for HugeGraph pd, store, and server images by restructuring Dockerfile layers to separate dependency resolution from source changes and by reducing build-context noise.
Changes:
- Added a root
.dockerignoreto reduce cache invalidation from non-build-impacting files. - Reordered Dockerfile steps to copy Maven
pom.xmlfiles first, runmvn dependency:go-offline, then copy full sources. - Enabled BuildKit cache mounts for Maven local repository (
/root/.m2) to speed up repeat builds.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
.dockerignore |
Excludes VCS/IDE/build-output and other cache-noisy files from Docker build context. |
hugegraph-pd/Dockerfile |
Adds BuildKit syntax, pom-first copy, go-offline step, and Maven cache mount to improve caching. |
hugegraph-store/Dockerfile |
Same caching refactor for the store image build stages. |
hugegraph-server/Dockerfile |
Same caching refactor for the server image build stages. |
hugegraph-server/Dockerfile-hstore |
Same caching refactor for the hstore variant build stages. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| COPY pom.xml ./ | ||
| COPY hugegraph-cluster-test/pom.xml ./hugegraph-cluster-test/pom.xml | ||
| COPY hugegraph-cluster-test/hugegraph-clustertest-dist/pom.xml ./hugegraph-cluster-test/hugegraph-clustertest-dist/pom.xml | ||
| COPY hugegraph-cluster-test/hugegraph-clustertest-minicluster/pom.xml ./hugegraph-cluster-test/hugegraph-clustertest-minicluster/pom.xml | ||
| COPY hugegraph-cluster-test/hugegraph-clustertest-test/pom.xml ./hugegraph-cluster-test/hugegraph-clustertest-test/pom.xml | ||
| COPY hugegraph-commons/pom.xml ./hugegraph-commons/pom.xml | ||
| COPY hugegraph-commons/hugegraph-common/pom.xml ./hugegraph-commons/hugegraph-common/pom.xml | ||
| COPY hugegraph-commons/hugegraph-rpc/pom.xml ./hugegraph-commons/hugegraph-rpc/pom.xml | ||
| COPY hugegraph-pd/pom.xml ./hugegraph-pd/pom.xml | ||
| COPY hugegraph-pd/hg-pd-cli/pom.xml ./hugegraph-pd/hg-pd-cli/pom.xml | ||
| COPY hugegraph-pd/hg-pd-client/pom.xml ./hugegraph-pd/hg-pd-client/pom.xml | ||
| COPY hugegraph-pd/hg-pd-common/pom.xml ./hugegraph-pd/hg-pd-common/pom.xml | ||
| COPY hugegraph-pd/hg-pd-core/pom.xml ./hugegraph-pd/hg-pd-core/pom.xml | ||
| COPY hugegraph-pd/hg-pd-dist/pom.xml ./hugegraph-pd/hg-pd-dist/pom.xml | ||
| COPY hugegraph-pd/hg-pd-grpc/pom.xml ./hugegraph-pd/hg-pd-grpc/pom.xml | ||
| COPY hugegraph-pd/hg-pd-service/pom.xml ./hugegraph-pd/hg-pd-service/pom.xml | ||
| COPY hugegraph-pd/hg-pd-test/pom.xml ./hugegraph-pd/hg-pd-test/pom.xml | ||
| COPY hugegraph-server/pom.xml ./hugegraph-server/pom.xml | ||
| COPY hugegraph-server/hugegraph-api/pom.xml ./hugegraph-server/hugegraph-api/pom.xml | ||
| COPY hugegraph-server/hugegraph-cassandra/pom.xml ./hugegraph-server/hugegraph-cassandra/pom.xml | ||
| COPY hugegraph-server/hugegraph-core/pom.xml ./hugegraph-server/hugegraph-core/pom.xml |
There was a problem hiding this comment.
This explicit, duplicated list of COPY ... pom.xml entries is likely to become brittle: adding/removing Maven modules will require updating this list (and the equivalent lists in other Dockerfiles), otherwise the mvn dependency:go-offline step can fail due to missing module directories/poms. Consider using BuildKit-supported patterns like COPY --parents **/pom.xml ./ (optionally alongside root-level build files) to reduce duplication while keeping the cache-friendly layer structure.
| COPY pom.xml ./ | |
| COPY hugegraph-cluster-test/pom.xml ./hugegraph-cluster-test/pom.xml | |
| COPY hugegraph-cluster-test/hugegraph-clustertest-dist/pom.xml ./hugegraph-cluster-test/hugegraph-clustertest-dist/pom.xml | |
| COPY hugegraph-cluster-test/hugegraph-clustertest-minicluster/pom.xml ./hugegraph-cluster-test/hugegraph-clustertest-minicluster/pom.xml | |
| COPY hugegraph-cluster-test/hugegraph-clustertest-test/pom.xml ./hugegraph-cluster-test/hugegraph-clustertest-test/pom.xml | |
| COPY hugegraph-commons/pom.xml ./hugegraph-commons/pom.xml | |
| COPY hugegraph-commons/hugegraph-common/pom.xml ./hugegraph-commons/hugegraph-common/pom.xml | |
| COPY hugegraph-commons/hugegraph-rpc/pom.xml ./hugegraph-commons/hugegraph-rpc/pom.xml | |
| COPY hugegraph-pd/pom.xml ./hugegraph-pd/pom.xml | |
| COPY hugegraph-pd/hg-pd-cli/pom.xml ./hugegraph-pd/hg-pd-cli/pom.xml | |
| COPY hugegraph-pd/hg-pd-client/pom.xml ./hugegraph-pd/hg-pd-client/pom.xml | |
| COPY hugegraph-pd/hg-pd-common/pom.xml ./hugegraph-pd/hg-pd-common/pom.xml | |
| COPY hugegraph-pd/hg-pd-core/pom.xml ./hugegraph-pd/hg-pd-core/pom.xml | |
| COPY hugegraph-pd/hg-pd-dist/pom.xml ./hugegraph-pd/hg-pd-dist/pom.xml | |
| COPY hugegraph-pd/hg-pd-grpc/pom.xml ./hugegraph-pd/hg-pd-grpc/pom.xml | |
| COPY hugegraph-pd/hg-pd-service/pom.xml ./hugegraph-pd/hg-pd-service/pom.xml | |
| COPY hugegraph-pd/hg-pd-test/pom.xml ./hugegraph-pd/hg-pd-test/pom.xml | |
| COPY hugegraph-server/pom.xml ./hugegraph-server/pom.xml | |
| COPY hugegraph-server/hugegraph-api/pom.xml ./hugegraph-server/hugegraph-api/pom.xml | |
| COPY hugegraph-server/hugegraph-cassandra/pom.xml ./hugegraph-server/hugegraph-cassandra/pom.xml | |
| COPY hugegraph-server/hugegraph-core/pom.xml ./hugegraph-server/hugegraph-core/pom.xml | |
| COPY --parents **/pom.xml ./ |
| @@ -1,3 +1,5 @@ | |||
| # syntax=docker/dockerfile:1.7 | |||
There was a problem hiding this comment.
The BuildKit-specific features introduced here (the # syntax=... directive and RUN --mount=type=cache) require Docker BuildKit to be enabled. If some environments still use the legacy builder (or run in restricted networks), this can fail because the frontend image may need to be pulled. Consider either documenting the BuildKit requirement in the Dockerfile comments and/or switching to a less specific frontend tag like docker/dockerfile:1 unless a 1.7-only feature is required.
| # syntax=docker/dockerfile:1.7 | |
| # syntax=docker/dockerfile:1 | |
| # NOTE: This Dockerfile requires Docker BuildKit to be enabled (DOCKER_BUILDKIT=1). |
| COPY pom.xml ./ | ||
| COPY hugegraph-cluster-test/pom.xml ./hugegraph-cluster-test/pom.xml | ||
| COPY hugegraph-cluster-test/hugegraph-clustertest-dist/pom.xml ./hugegraph-cluster-test/hugegraph-clustertest-dist/pom.xml | ||
| COPY hugegraph-cluster-test/hugegraph-clustertest-minicluster/pom.xml ./hugegraph-cluster-test/hugegraph-clustertest-minicluster/pom.xml | ||
| COPY hugegraph-cluster-test/hugegraph-clustertest-test/pom.xml ./hugegraph-cluster-test/hugegraph-clustertest-test/pom.xml | ||
| COPY hugegraph-commons/pom.xml ./hugegraph-commons/pom.xml | ||
| COPY hugegraph-commons/hugegraph-common/pom.xml ./hugegraph-commons/hugegraph-common/pom.xml | ||
| COPY hugegraph-commons/hugegraph-rpc/pom.xml ./hugegraph-commons/hugegraph-rpc/pom.xml | ||
| COPY hugegraph-pd/pom.xml ./hugegraph-pd/pom.xml | ||
| COPY hugegraph-pd/hg-pd-cli/pom.xml ./hugegraph-pd/hg-pd-cli/pom.xml | ||
| COPY hugegraph-pd/hg-pd-client/pom.xml ./hugegraph-pd/hg-pd-client/pom.xml | ||
| COPY hugegraph-pd/hg-pd-common/pom.xml ./hugegraph-pd/hg-pd-common/pom.xml | ||
| COPY hugegraph-pd/hg-pd-core/pom.xml ./hugegraph-pd/hg-pd-core/pom.xml | ||
| COPY hugegraph-pd/hg-pd-dist/pom.xml ./hugegraph-pd/hg-pd-dist/pom.xml | ||
| COPY hugegraph-pd/hg-pd-grpc/pom.xml ./hugegraph-pd/hg-pd-grpc/pom.xml | ||
| COPY hugegraph-pd/hg-pd-service/pom.xml ./hugegraph-pd/hg-pd-service/pom.xml | ||
| COPY hugegraph-pd/hg-pd-test/pom.xml ./hugegraph-pd/hg-pd-test/pom.xml | ||
| COPY hugegraph-server/pom.xml ./hugegraph-server/pom.xml | ||
| COPY hugegraph-server/hugegraph-api/pom.xml ./hugegraph-server/hugegraph-api/pom.xml | ||
| COPY hugegraph-server/hugegraph-cassandra/pom.xml ./hugegraph-server/hugegraph-cassandra/pom.xml | ||
| COPY hugegraph-server/hugegraph-core/pom.xml ./hugegraph-server/hugegraph-core/pom.xml |
There was a problem hiding this comment.
This explicit, duplicated list of COPY ... pom.xml entries is likely to become brittle: adding/removing Maven modules will require updating this list (and the equivalent lists in other Dockerfiles), otherwise the mvn dependency:go-offline step can fail due to missing module directories/poms. Consider using BuildKit-supported patterns like COPY --parents **/pom.xml ./ (optionally alongside root-level build files) to reduce duplication while keeping the cache-friendly layer structure.
| COPY pom.xml ./ | |
| COPY hugegraph-cluster-test/pom.xml ./hugegraph-cluster-test/pom.xml | |
| COPY hugegraph-cluster-test/hugegraph-clustertest-dist/pom.xml ./hugegraph-cluster-test/hugegraph-clustertest-dist/pom.xml | |
| COPY hugegraph-cluster-test/hugegraph-clustertest-minicluster/pom.xml ./hugegraph-cluster-test/hugegraph-clustertest-minicluster/pom.xml | |
| COPY hugegraph-cluster-test/hugegraph-clustertest-test/pom.xml ./hugegraph-cluster-test/hugegraph-clustertest-test/pom.xml | |
| COPY hugegraph-commons/pom.xml ./hugegraph-commons/pom.xml | |
| COPY hugegraph-commons/hugegraph-common/pom.xml ./hugegraph-commons/hugegraph-common/pom.xml | |
| COPY hugegraph-commons/hugegraph-rpc/pom.xml ./hugegraph-commons/hugegraph-rpc/pom.xml | |
| COPY hugegraph-pd/pom.xml ./hugegraph-pd/pom.xml | |
| COPY hugegraph-pd/hg-pd-cli/pom.xml ./hugegraph-pd/hg-pd-cli/pom.xml | |
| COPY hugegraph-pd/hg-pd-client/pom.xml ./hugegraph-pd/hg-pd-client/pom.xml | |
| COPY hugegraph-pd/hg-pd-common/pom.xml ./hugegraph-pd/hg-pd-common/pom.xml | |
| COPY hugegraph-pd/hg-pd-core/pom.xml ./hugegraph-pd/hg-pd-core/pom.xml | |
| COPY hugegraph-pd/hg-pd-dist/pom.xml ./hugegraph-pd/hg-pd-dist/pom.xml | |
| COPY hugegraph-pd/hg-pd-grpc/pom.xml ./hugegraph-pd/hg-pd-grpc/pom.xml | |
| COPY hugegraph-pd/hg-pd-service/pom.xml ./hugegraph-pd/hg-pd-service/pom.xml | |
| COPY hugegraph-pd/hg-pd-test/pom.xml ./hugegraph-pd/hg-pd-test/pom.xml | |
| COPY hugegraph-server/pom.xml ./hugegraph-server/pom.xml | |
| COPY hugegraph-server/hugegraph-api/pom.xml ./hugegraph-server/hugegraph-api/pom.xml | |
| COPY hugegraph-server/hugegraph-cassandra/pom.xml ./hugegraph-server/hugegraph-cassandra/pom.xml | |
| COPY hugegraph-server/hugegraph-core/pom.xml ./hugegraph-server/hugegraph-core/pom.xml | |
| COPY --parents pom.xml **/pom.xml ./ |
| # syntax=docker/dockerfile:1.7 | ||
|
|
There was a problem hiding this comment.
The BuildKit-specific features introduced here (the # syntax=... directive and RUN --mount=type=cache) require Docker BuildKit to be enabled. If some environments still use the legacy builder (or run in restricted networks), this can fail because the frontend image may need to be pulled. Consider either documenting the BuildKit requirement in the Dockerfile comments and/or switching to a less specific frontend tag like docker/dockerfile:1 unless a 1.7-only feature is required.
| COPY pom.xml ./ | ||
| COPY hugegraph-cluster-test/pom.xml ./hugegraph-cluster-test/pom.xml | ||
| COPY hugegraph-cluster-test/hugegraph-clustertest-dist/pom.xml ./hugegraph-cluster-test/hugegraph-clustertest-dist/pom.xml | ||
| COPY hugegraph-cluster-test/hugegraph-clustertest-minicluster/pom.xml ./hugegraph-cluster-test/hugegraph-clustertest-minicluster/pom.xml | ||
| COPY hugegraph-cluster-test/hugegraph-clustertest-test/pom.xml ./hugegraph-cluster-test/hugegraph-clustertest-test/pom.xml | ||
| COPY hugegraph-commons/pom.xml ./hugegraph-commons/pom.xml | ||
| COPY hugegraph-commons/hugegraph-common/pom.xml ./hugegraph-commons/hugegraph-common/pom.xml | ||
| COPY hugegraph-commons/hugegraph-rpc/pom.xml ./hugegraph-commons/hugegraph-rpc/pom.xml | ||
| COPY hugegraph-pd/pom.xml ./hugegraph-pd/pom.xml | ||
| COPY hugegraph-pd/hg-pd-cli/pom.xml ./hugegraph-pd/hg-pd-cli/pom.xml | ||
| COPY hugegraph-pd/hg-pd-client/pom.xml ./hugegraph-pd/hg-pd-client/pom.xml | ||
| COPY hugegraph-pd/hg-pd-common/pom.xml ./hugegraph-pd/hg-pd-common/pom.xml | ||
| COPY hugegraph-pd/hg-pd-core/pom.xml ./hugegraph-pd/hg-pd-core/pom.xml | ||
| COPY hugegraph-pd/hg-pd-dist/pom.xml ./hugegraph-pd/hg-pd-dist/pom.xml | ||
| COPY hugegraph-pd/hg-pd-grpc/pom.xml ./hugegraph-pd/hg-pd-grpc/pom.xml | ||
| COPY hugegraph-pd/hg-pd-service/pom.xml ./hugegraph-pd/hg-pd-service/pom.xml | ||
| COPY hugegraph-pd/hg-pd-test/pom.xml ./hugegraph-pd/hg-pd-test/pom.xml | ||
| COPY hugegraph-server/pom.xml ./hugegraph-server/pom.xml | ||
| COPY hugegraph-server/hugegraph-api/pom.xml ./hugegraph-server/hugegraph-api/pom.xml | ||
| COPY hugegraph-server/hugegraph-cassandra/pom.xml ./hugegraph-server/hugegraph-cassandra/pom.xml | ||
| COPY hugegraph-server/hugegraph-core/pom.xml ./hugegraph-server/hugegraph-core/pom.xml |
There was a problem hiding this comment.
This explicit, duplicated list of COPY ... pom.xml entries is likely to become brittle: adding/removing Maven modules will require updating this list (and the equivalent lists in other Dockerfiles), otherwise the mvn dependency:go-offline step can fail due to missing module directories/poms. Consider using BuildKit-supported patterns like COPY --parents **/pom.xml ./ (optionally alongside root-level build files) to reduce duplication while keeping the cache-friendly layer structure.
| COPY pom.xml ./ | |
| COPY hugegraph-cluster-test/pom.xml ./hugegraph-cluster-test/pom.xml | |
| COPY hugegraph-cluster-test/hugegraph-clustertest-dist/pom.xml ./hugegraph-cluster-test/hugegraph-clustertest-dist/pom.xml | |
| COPY hugegraph-cluster-test/hugegraph-clustertest-minicluster/pom.xml ./hugegraph-cluster-test/hugegraph-clustertest-minicluster/pom.xml | |
| COPY hugegraph-cluster-test/hugegraph-clustertest-test/pom.xml ./hugegraph-cluster-test/hugegraph-clustertest-test/pom.xml | |
| COPY hugegraph-commons/pom.xml ./hugegraph-commons/pom.xml | |
| COPY hugegraph-commons/hugegraph-common/pom.xml ./hugegraph-commons/hugegraph-common/pom.xml | |
| COPY hugegraph-commons/hugegraph-rpc/pom.xml ./hugegraph-commons/hugegraph-rpc/pom.xml | |
| COPY hugegraph-pd/pom.xml ./hugegraph-pd/pom.xml | |
| COPY hugegraph-pd/hg-pd-cli/pom.xml ./hugegraph-pd/hg-pd-cli/pom.xml | |
| COPY hugegraph-pd/hg-pd-client/pom.xml ./hugegraph-pd/hg-pd-client/pom.xml | |
| COPY hugegraph-pd/hg-pd-common/pom.xml ./hugegraph-pd/hg-pd-common/pom.xml | |
| COPY hugegraph-pd/hg-pd-core/pom.xml ./hugegraph-pd/hg-pd-core/pom.xml | |
| COPY hugegraph-pd/hg-pd-dist/pom.xml ./hugegraph-pd/hg-pd-dist/pom.xml | |
| COPY hugegraph-pd/hg-pd-grpc/pom.xml ./hugegraph-pd/hg-pd-grpc/pom.xml | |
| COPY hugegraph-pd/hg-pd-service/pom.xml ./hugegraph-pd/hg-pd-service/pom.xml | |
| COPY hugegraph-pd/hg-pd-test/pom.xml ./hugegraph-pd/hg-pd-test/pom.xml | |
| COPY hugegraph-server/pom.xml ./hugegraph-server/pom.xml | |
| COPY hugegraph-server/hugegraph-api/pom.xml ./hugegraph-server/hugegraph-api/pom.xml | |
| COPY hugegraph-server/hugegraph-cassandra/pom.xml ./hugegraph-server/hugegraph-cassandra/pom.xml | |
| COPY hugegraph-server/hugegraph-core/pom.xml ./hugegraph-server/hugegraph-core/pom.xml | |
| COPY --parents **/pom.xml ./ |
| # syntax=docker/dockerfile:1.7 | ||
|
|
There was a problem hiding this comment.
The BuildKit-specific features introduced here (the # syntax=... directive and RUN --mount=type=cache) require Docker BuildKit to be enabled. If some environments still use the legacy builder (or run in restricted networks), this can fail because the frontend image may need to be pulled. Consider either documenting the BuildKit requirement in the Dockerfile comments and/or switching to a less specific frontend tag like docker/dockerfile:1 unless a 1.7-only feature is required.
| COPY pom.xml ./ | ||
| COPY hugegraph-cluster-test/pom.xml ./hugegraph-cluster-test/pom.xml | ||
| COPY hugegraph-cluster-test/hugegraph-clustertest-dist/pom.xml ./hugegraph-cluster-test/hugegraph-clustertest-dist/pom.xml | ||
| COPY hugegraph-cluster-test/hugegraph-clustertest-minicluster/pom.xml ./hugegraph-cluster-test/hugegraph-clustertest-minicluster/pom.xml | ||
| COPY hugegraph-cluster-test/hugegraph-clustertest-test/pom.xml ./hugegraph-cluster-test/hugegraph-clustertest-test/pom.xml | ||
| COPY hugegraph-commons/pom.xml ./hugegraph-commons/pom.xml | ||
| COPY hugegraph-commons/hugegraph-common/pom.xml ./hugegraph-commons/hugegraph-common/pom.xml | ||
| COPY hugegraph-commons/hugegraph-rpc/pom.xml ./hugegraph-commons/hugegraph-rpc/pom.xml | ||
| COPY hugegraph-pd/pom.xml ./hugegraph-pd/pom.xml | ||
| COPY hugegraph-pd/hg-pd-cli/pom.xml ./hugegraph-pd/hg-pd-cli/pom.xml | ||
| COPY hugegraph-pd/hg-pd-client/pom.xml ./hugegraph-pd/hg-pd-client/pom.xml | ||
| COPY hugegraph-pd/hg-pd-common/pom.xml ./hugegraph-pd/hg-pd-common/pom.xml | ||
| COPY hugegraph-pd/hg-pd-core/pom.xml ./hugegraph-pd/hg-pd-core/pom.xml | ||
| COPY hugegraph-pd/hg-pd-dist/pom.xml ./hugegraph-pd/hg-pd-dist/pom.xml | ||
| COPY hugegraph-pd/hg-pd-grpc/pom.xml ./hugegraph-pd/hg-pd-grpc/pom.xml | ||
| COPY hugegraph-pd/hg-pd-service/pom.xml ./hugegraph-pd/hg-pd-service/pom.xml | ||
| COPY hugegraph-pd/hg-pd-test/pom.xml ./hugegraph-pd/hg-pd-test/pom.xml | ||
| COPY hugegraph-server/pom.xml ./hugegraph-server/pom.xml | ||
| COPY hugegraph-server/hugegraph-api/pom.xml ./hugegraph-server/hugegraph-api/pom.xml | ||
| COPY hugegraph-server/hugegraph-cassandra/pom.xml ./hugegraph-server/hugegraph-cassandra/pom.xml | ||
| COPY hugegraph-server/hugegraph-core/pom.xml ./hugegraph-server/hugegraph-core/pom.xml |
There was a problem hiding this comment.
This explicit, duplicated list of COPY ... pom.xml entries is likely to become brittle: adding/removing Maven modules will require updating this list (and the equivalent lists in other Dockerfiles), otherwise the mvn dependency:go-offline step can fail due to missing module directories/poms. Consider using BuildKit-supported patterns like COPY --parents **/pom.xml ./ (optionally alongside root-level build files) to reduce duplication while keeping the cache-friendly layer structure.
| COPY pom.xml ./ | |
| COPY hugegraph-cluster-test/pom.xml ./hugegraph-cluster-test/pom.xml | |
| COPY hugegraph-cluster-test/hugegraph-clustertest-dist/pom.xml ./hugegraph-cluster-test/hugegraph-clustertest-dist/pom.xml | |
| COPY hugegraph-cluster-test/hugegraph-clustertest-minicluster/pom.xml ./hugegraph-cluster-test/hugegraph-clustertest-minicluster/pom.xml | |
| COPY hugegraph-cluster-test/hugegraph-clustertest-test/pom.xml ./hugegraph-cluster-test/hugegraph-clustertest-test/pom.xml | |
| COPY hugegraph-commons/pom.xml ./hugegraph-commons/pom.xml | |
| COPY hugegraph-commons/hugegraph-common/pom.xml ./hugegraph-commons/hugegraph-common/pom.xml | |
| COPY hugegraph-commons/hugegraph-rpc/pom.xml ./hugegraph-commons/hugegraph-rpc/pom.xml | |
| COPY hugegraph-pd/pom.xml ./hugegraph-pd/pom.xml | |
| COPY hugegraph-pd/hg-pd-cli/pom.xml ./hugegraph-pd/hg-pd-cli/pom.xml | |
| COPY hugegraph-pd/hg-pd-client/pom.xml ./hugegraph-pd/hg-pd-client/pom.xml | |
| COPY hugegraph-pd/hg-pd-common/pom.xml ./hugegraph-pd/hg-pd-common/pom.xml | |
| COPY hugegraph-pd/hg-pd-core/pom.xml ./hugegraph-pd/hg-pd-core/pom.xml | |
| COPY hugegraph-pd/hg-pd-dist/pom.xml ./hugegraph-pd/hg-pd-dist/pom.xml | |
| COPY hugegraph-pd/hg-pd-grpc/pom.xml ./hugegraph-pd/hg-pd-grpc/pom.xml | |
| COPY hugegraph-pd/hg-pd-service/pom.xml ./hugegraph-pd/hg-pd-service/pom.xml | |
| COPY hugegraph-pd/hg-pd-test/pom.xml ./hugegraph-pd/hg-pd-test/pom.xml | |
| COPY hugegraph-server/pom.xml ./hugegraph-server/pom.xml | |
| COPY hugegraph-server/hugegraph-api/pom.xml ./hugegraph-server/hugegraph-api/pom.xml | |
| COPY hugegraph-server/hugegraph-cassandra/pom.xml ./hugegraph-server/hugegraph-cassandra/pom.xml | |
| COPY hugegraph-server/hugegraph-core/pom.xml ./hugegraph-server/hugegraph-core/pom.xml | |
| COPY --parents **/pom.xml ./ |
| # syntax=docker/dockerfile:1.7 | ||
|
|
There was a problem hiding this comment.
The BuildKit-specific features introduced here (the # syntax=... directive and RUN --mount=type=cache) require Docker BuildKit to be enabled. If some environments still use the legacy builder (or run in restricted networks), this can fail because the frontend image may need to be pulled. Consider either documenting the BuildKit requirement in the Dockerfile comments and/or switching to a less specific frontend tag like docker/dockerfile:1 unless a 1.7-only feature is required.
Purpose of the PR
Main Changes
.dockerignoreto exclude cache-noisy files that should not affect Docker image builds, while keeping required Maven module sources in the build context.hugegraph-pd/Dockerfile,hugegraph-store/Dockerfile,hugegraph-server/Dockerfile, andhugegraph-server/Dockerfile-hstoreto copy dependency-relatedpom.xmlfiles before copying the full source tree.--mount=type=cache,target=/root/.m2for both dependency resolution and package steps..dockerignorerule so Maven module directories such ashugegraph-server/hugegraph-distremain included in the Docker build context.Verifying these changes
DOCKER_BUILDKIT=1:docker build -f hugegraph-pd/Dockerfile -t hugegraph-pd:cache-test .docker build -f hugegraph-store/Dockerfile -t hugegraph-store:cache-test .docker build -f hugegraph-server/Dockerfile -t hugegraph-server:cache-test .docker build -f hugegraph-server/Dockerfile-hstore -t hugegraph-server-hstore:cache-test .hugegraph-server/Dockerfile-hstore:5.77s -> 2.84s(~50.7%faster)hugegraph-pd/Dockerfile:7.79s -> 3.59s(~53.9%faster)Does this PR potentially affect the following parts?
Documentation Status
Doc - TODODoc - DoneDoc - No Need