You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hugegraph.apache.org by "VGalaxies (via GitHub)" <gi...@apache.org> on 2026/06/24 19:01:58 UTC

Re: [PR] perf(docker): improve pd/store/server image build cache efficiency [hugegraph]

VGalaxies commented on code in PR #2981:
URL: https://github.com/apache/hugegraph/pull/2981#discussion_r3469562421


##########
hugegraph-pd/Dockerfile:
##########
@@ -19,11 +21,68 @@
 # 1st stage: build source code
 FROM maven:3.9.0-eclipse-temurin-11 AS build
 
-COPY . /pkg
 WORKDIR /pkg
 ARG MAVEN_ARGS
 
-RUN mvn package $MAVEN_ARGS -e -B -ntp -Dmaven.test.skip=true -Dmaven.javadoc.skip=true && pwd && ls -l && rm \
+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 hugegraph-server/hugegraph-dist/pom.xml ./hugegraph-server/hugegraph-dist/pom.xml
+COPY hugegraph-server/hugegraph-example/pom.xml ./hugegraph-server/hugegraph-example/pom.xml
+COPY hugegraph-server/hugegraph-hbase/pom.xml ./hugegraph-server/hugegraph-hbase/pom.xml
+COPY hugegraph-server/hugegraph-hstore/pom.xml ./hugegraph-server/hugegraph-hstore/pom.xml
+COPY hugegraph-server/hugegraph-mysql/pom.xml ./hugegraph-server/hugegraph-mysql/pom.xml
+COPY hugegraph-server/hugegraph-palo/pom.xml ./hugegraph-server/hugegraph-palo/pom.xml
+COPY hugegraph-server/hugegraph-postgresql/pom.xml ./hugegraph-server/hugegraph-postgresql/pom.xml
+COPY hugegraph-server/hugegraph-rocksdb/pom.xml ./hugegraph-server/hugegraph-rocksdb/pom.xml
+COPY hugegraph-server/hugegraph-scylladb/pom.xml ./hugegraph-server/hugegraph-scylladb/pom.xml
+COPY hugegraph-server/hugegraph-test/pom.xml ./hugegraph-server/hugegraph-test/pom.xml
+COPY hugegraph-store/pom.xml ./hugegraph-store/pom.xml
+COPY hugegraph-store/hg-store-cli/pom.xml ./hugegraph-store/hg-store-cli/pom.xml
+COPY hugegraph-store/hg-store-client/pom.xml ./hugegraph-store/hg-store-client/pom.xml
+COPY hugegraph-store/hg-store-common/pom.xml ./hugegraph-store/hg-store-common/pom.xml
+COPY hugegraph-store/hg-store-core/pom.xml ./hugegraph-store/hg-store-core/pom.xml
+COPY hugegraph-store/hg-store-dist/pom.xml ./hugegraph-store/hg-store-dist/pom.xml
+COPY hugegraph-store/hg-store-grpc/pom.xml ./hugegraph-store/hg-store-grpc/pom.xml
+COPY hugegraph-store/hg-store-node/pom.xml ./hugegraph-store/hg-store-node/pom.xml
+COPY hugegraph-store/hg-store-rocksdb/pom.xml ./hugegraph-store/hg-store-rocksdb/pom.xml
+COPY hugegraph-store/hg-store-test/pom.xml ./hugegraph-store/hg-store-test/pom.xml
+COPY hugegraph-struct/pom.xml ./hugegraph-struct/pom.xml
+COPY install-dist/pom.xml ./install-dist/pom.xml
+
+RUN --mount=type=cache,target=/root/.m2 \

Review Comment:
   **Medium: Lock the shared Maven cache mount**
   
   `hugegraph-pd/Dockerfile:71`
   
   **Evidence**
   - The PR adds `RUN --mount=type=cache,target=/root/.m2` in all four Dockerfiles at `hugegraph-pd/Dockerfile:71`, `hugegraph-pd/Dockerfile:84`, `hugegraph-store/Dockerfile:71`, `hugegraph-store/Dockerfile:84`, `hugegraph-server/Dockerfile:71`, `hugegraph-server/Dockerfile:84`, `hugegraph-server/Dockerfile-hstore:71`, and `hugegraph-server/Dockerfile-hstore:84`. BuildKit cache mounts default to shared access when `sharing` is omitted.
   
   **Impact**
   - Parallel builds, such as building the PD, Store, and Server images together, can run multiple Maven processes against the same writable local repository cache. Maven local repositories are not safe for concurrent writers, so this can leave partial artifacts or metadata in `/root/.m2` and make image builds flaky.
   
   **Requested fix**
   - Add locking to every Maven cache mount, for example `--mount=type=cache,target=/root/.m2,sharing=locked`, or use distinct cache IDs per image/build path.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@hugegraph.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@hugegraph.apache.org
For additional commands, e-mail: issues-help@hugegraph.apache.org