Skip to content

perf(docker): improve pd/store/server image build cache efficiency#2981

Open
zeel2104 wants to merge 1 commit intoapache:masterfrom
zeel2104:improve-docker-build-cache-2977
Open

perf(docker): improve pd/store/server image build cache efficiency#2981
zeel2104 wants to merge 1 commit intoapache:masterfrom
zeel2104:improve-docker-build-cache-2977

Conversation

@zeel2104
Copy link
Copy Markdown

Purpose of the PR

Main Changes

  • Added a root .dockerignore to exclude cache-noisy files that should not affect Docker image builds, while keeping required Maven module sources in the build context.
  • Refactored hugegraph-pd/Dockerfile, hugegraph-store/Dockerfile, hugegraph-server/Dockerfile, and hugegraph-server/Dockerfile-hstore to copy dependency-related pom.xml files before copying the full source tree.
  • Added BuildKit Maven cache mounts with --mount=type=cache,target=/root/.m2 for both dependency resolution and package steps.
  • Kept existing runtime image behavior unchanged, including entrypoints, ports, and container startup flow.
  • During validation, narrowed an overly broad .dockerignore rule so Maven module directories such as hugegraph-server/hugegraph-dist remain included in the Docker build context.

Verifying these changes

  • Trivial rework / code cleanup without any test coverage. (No Need)
  • Already covered by existing tests, such as (please modify tests here).
  • Need tests and can be verified as follows:
    • Build all four images successfully with 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 .
    • Rebuild images back-to-back without Java source changes and compare timings/cache reuse:
      • hugegraph-server/Dockerfile-hstore: 5.77s -> 2.84s (~50.7% faster)
      • hugegraph-pd/Dockerfile: 7.79s -> 3.59s (~53.9% faster)
    • Confirm build logs show cached reuse for the pom-first dependency layer, Maven cache mount, and later package/runtime layers.

Does this PR potentially affect the following parts?

Documentation Status

  • Doc - TODO
  • Doc - Done
  • Doc - No Need

@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. ci-cd Build or deploy perf labels Mar 29, 2026
@imbajin imbajin requested a review from Copilot March 29, 2026 12:05
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 .dockerignore to reduce cache invalidation from non-build-impacting files.
  • Reordered Dockerfile steps to copy Maven pom.xml files first, run mvn 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.

Comment on lines +27 to +47
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 link

Copilot AI Mar 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
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 ./

Copilot uses AI. Check for mistakes.
@@ -1,3 +1,5 @@
# syntax=docker/dockerfile:1.7
Copy link

Copilot AI Mar 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
# syntax=docker/dockerfile:1.7
# syntax=docker/dockerfile:1
# NOTE: This Dockerfile requires Docker BuildKit to be enabled (DOCKER_BUILDKIT=1).

Copilot uses AI. Check for mistakes.
Comment on lines +27 to +47
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 link

Copilot AI Mar 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
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 ./

Copilot uses AI. Check for mistakes.
Comment on lines +1 to +2
# syntax=docker/dockerfile:1.7

Copy link

Copilot AI Mar 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Comment on lines +27 to +47
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 link

Copilot AI Mar 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
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 ./

Copilot uses AI. Check for mistakes.
Comment on lines +1 to +2
# syntax=docker/dockerfile:1.7

Copy link

Copilot AI Mar 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Comment on lines +27 to +47
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 link

Copilot AI Mar 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
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 ./

Copilot uses AI. Check for mistakes.
Comment on lines +1 to +2
# syntax=docker/dockerfile:1.7

Copy link

Copilot AI Mar 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci-cd Build or deploy perf size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Task] Improve Docker build cache efficiency for pd/store/server images

2 participants