Copilot commented on code in PR #3025:
URL: https://github.com/apache/hugegraph/pull/3025#discussion_r3240714606
##########
hugegraph-pd/Dockerfile:
##########
@@ -16,15 +16,21 @@
#
# Dockerfile for HugeGraph PD
+# NOTE: Build with DOCKER_BUILDKIT=1 to enable cache mounts and --parents COPY.
# 1st stage: build source code
FROM maven:3.9.0-eclipse-temurin-11 AS build
-COPY . /pkg
WORKDIR /pkg
+
+# Copy pom files first — layer is only invalidated when pom files change,
+# keeping the Maven cache mount warm across source-only changes.
+COPY --parents **/pom.xml ./
Review Comment:
BuildKit alone does not enable `COPY --parents`; this option requires a
Dockerfile frontend that supports the labs feature, declared with a top-of-file
syntax directive. Without that directive, builds using the stable/default
frontend will fail here with an unknown flag before reaching the Maven step.
##########
hugegraph-server/Dockerfile:
##########
@@ -16,18 +16,24 @@
#
# Dockerfile for HugeGraph Server
+# NOTE: Build with DOCKER_BUILDKIT=1 to enable cache mounts and --parents COPY.
# 1st stage: build source code
FROM maven:3.9.0-eclipse-temurin-11 AS build
-COPY . /pkg
WORKDIR /pkg
+
+# Copy pom files first — layer is only invalidated when pom files change,
+# keeping the Maven cache mount warm across source-only changes.
+COPY --parents **/pom.xml ./
Review Comment:
BuildKit alone does not enable `COPY --parents`; this option requires a
Dockerfile frontend that supports the labs feature, declared with a top-of-file
syntax directive. Without that directive, builds using the stable/default
frontend will fail here with an unknown flag before reaching the Maven step.
##########
hugegraph-store/Dockerfile:
##########
@@ -16,15 +16,21 @@
#
# Dockerfile for HugeGraph Store
+# NOTE: Build with DOCKER_BUILDKIT=1 to enable cache mounts and --parents COPY.
# 1st stage: build source code
FROM maven:3.9.0-eclipse-temurin-11 AS build
-COPY . /pkg
WORKDIR /pkg
+
+# Copy pom files first — layer is only invalidated when pom files change,
+# keeping the Maven cache mount warm across source-only changes.
+COPY --parents **/pom.xml ./
Review Comment:
BuildKit alone does not enable `COPY --parents`; this option requires a
Dockerfile frontend that supports the labs feature, declared with a top-of-file
syntax directive. Without that directive, builds using the stable/default
frontend will fail here with an unknown flag before reaching the Maven step.
##########
hugegraph-pd/Dockerfile:
##########
@@ -16,15 +16,21 @@
#
# Dockerfile for HugeGraph PD
+# NOTE: Build with DOCKER_BUILDKIT=1 to enable cache mounts and --parents COPY.
# 1st stage: build source code
FROM maven:3.9.0-eclipse-temurin-11 AS build
-COPY . /pkg
WORKDIR /pkg
+
+# Copy pom files first — layer is only invalidated when pom files change,
+# keeping the Maven cache mount warm across source-only changes.
+COPY --parents **/pom.xml ./
ARG MAVEN_ARGS
Review Comment:
The expensive Maven package step still depends on `COPY . .`, so any source
or unrelated context change invalidates this layer. Since there is no
dependency-resolution RUN between the pom-only copy and this full copy, the new
pom-only layer does not provide the stated source-change cache benefit beyond
the Maven cache mount.
##########
hugegraph-server/Dockerfile:
##########
@@ -16,18 +16,24 @@
#
# Dockerfile for HugeGraph Server
+# NOTE: Build with DOCKER_BUILDKIT=1 to enable cache mounts and --parents COPY.
# 1st stage: build source code
FROM maven:3.9.0-eclipse-temurin-11 AS build
-COPY . /pkg
WORKDIR /pkg
+
+# Copy pom files first — layer is only invalidated when pom files change,
+# keeping the Maven cache mount warm across source-only changes.
+COPY --parents **/pom.xml ./
ARG MAVEN_ARGS
Review Comment:
The expensive Maven package step still depends on `COPY . .`, so any source
or unrelated context change invalidates this layer. Since there is no
dependency-resolution RUN between the pom-only copy and this full copy, the new
pom-only layer does not provide the stated source-change cache benefit beyond
the Maven cache mount.
##########
hugegraph-server/Dockerfile-hstore:
##########
@@ -15,19 +15,25 @@
# limitations under the License.
#
-# Dockerfile for HugeGraph Server
+# Dockerfile for HugeGraph Server (hstore backend)
+# NOTE: Build with DOCKER_BUILDKIT=1 to enable cache mounts and --parents COPY.
# 1st stage: build source code
FROM maven:3.9.0-eclipse-temurin-11 AS build
-COPY . /pkg
WORKDIR /pkg
+
+# Copy pom files first — layer is only invalidated when pom files change,
+# keeping the Maven cache mount warm across source-only changes.
+COPY --parents **/pom.xml ./
Review Comment:
BuildKit alone does not enable `COPY --parents`; this option requires a
Dockerfile frontend that supports the labs feature, declared with a top-of-file
syntax directive. Without that directive, builds using the stable/default
frontend will fail here with an unknown flag before reaching the Maven step.
##########
hugegraph-server/Dockerfile:
##########
@@ -39,25 +45,17 @@ ENV JAVA_OPTS="-XX:+UnlockExperimentalVMOptions
-XX:+UseContainerSupport -XX:Max
HUGEGRAPH_HOME="hugegraph-server" \
STDOUT_MODE="true"
-#COPY . /hugegraph/hugegraph-server
WORKDIR /hugegraph-server/
-# 1. Install environment and init HugeGraph Sever
-RUN set -x \
- && rm /var/lib/dpkg/info/libc-bin.* \
- && apt-get -q clean \
- && apt-get -q update \
+# 1. Install runtime dependencies and configure server
+RUN apt-get -q update \
&& apt-get -q install -y --no-install-recommends --no-install-suggests \
dumb-init \
procps \
curl \
lsof \
Review Comment:
This runtime image no longer installs a package that provides `crontab`, but
the bundled server scripts still support `start-hugegraph.sh -m true` by
calling `start-monitor.sh`, which invokes `crontab_append`. That optional
monitor path will now fail with `crontab: command not found`, changing runtime
behavior for users who enable it.
##########
hugegraph-store/Dockerfile:
##########
@@ -16,15 +16,21 @@
#
# Dockerfile for HugeGraph Store
+# NOTE: Build with DOCKER_BUILDKIT=1 to enable cache mounts and --parents COPY.
# 1st stage: build source code
FROM maven:3.9.0-eclipse-temurin-11 AS build
-COPY . /pkg
WORKDIR /pkg
+
+# Copy pom files first — layer is only invalidated when pom files change,
+# keeping the Maven cache mount warm across source-only changes.
+COPY --parents **/pom.xml ./
ARG MAVEN_ARGS
Review Comment:
The expensive Maven package step still depends on `COPY . .`, so any source
or unrelated context change invalidates this layer. Since there is no
dependency-resolution RUN between the pom-only copy and this full copy, the new
pom-only layer does not provide the stated source-change cache benefit beyond
the Maven cache mount.
##########
.dockerignore:
##########
@@ -0,0 +1,34 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# NOTE: This file intentionally stays minimal.
+# Most patterns (IDE files, build artifacts, logs, OS files) are already
+# covered by .gitignore. Only Docker-specific extras are listed here.
Review Comment:
Docker does not apply `.gitignore` when preparing this local build context.
In particular, existing `target/` directories from prior local Maven builds
will still be sent and copied by `COPY . .`; because the Dockerfiles run `mvn
package` without `clean`, stale host build outputs can be packaged into the
image as well as invalidating cache layers.
##########
hugegraph-server/Dockerfile-hstore:
##########
@@ -15,19 +15,25 @@
# limitations under the License.
#
-# Dockerfile for HugeGraph Server
+# Dockerfile for HugeGraph Server (hstore backend)
+# NOTE: Build with DOCKER_BUILDKIT=1 to enable cache mounts and --parents COPY.
# 1st stage: build source code
FROM maven:3.9.0-eclipse-temurin-11 AS build
-COPY . /pkg
WORKDIR /pkg
+
+# Copy pom files first — layer is only invalidated when pom files change,
+# keeping the Maven cache mount warm across source-only changes.
+COPY --parents **/pom.xml ./
ARG MAVEN_ARGS
Review Comment:
The expensive Maven package step still depends on `COPY . .`, so any source
or unrelated context change invalidates this layer. Since there is no
dependency-resolution RUN between the pom-only copy and this full copy, the new
pom-only layer does not provide the stated source-change cache benefit beyond
the Maven cache mount.
##########
hugegraph-pd/Dockerfile:
##########
@@ -16,15 +16,21 @@
#
# Dockerfile for HugeGraph PD
+# NOTE: Build with DOCKER_BUILDKIT=1 to enable cache mounts and --parents COPY.
# 1st stage: build source code
FROM maven:3.9.0-eclipse-temurin-11 AS build
-COPY . /pkg
WORKDIR /pkg
+
+# Copy pom files first — layer is only invalidated when pom files change,
+# keeping the Maven cache mount warm across source-only changes.
+COPY --parents **/pom.xml ./
Review Comment:
Even after enabling `--parents`, this glob does not capture all Maven
descriptors: Dockerfile COPY globs are not recursive in the `.dockerignore`
sense, so the root `pom.xml` and nested module POMs such as
`hugegraph-pd/hg-pd-core/pom.xml` are not included in this pom-only layer. That
makes the dependency-cache layer incomplete for this multi-module build.
##########
hugegraph-store/Dockerfile:
##########
@@ -16,15 +16,21 @@
#
# Dockerfile for HugeGraph Store
+# NOTE: Build with DOCKER_BUILDKIT=1 to enable cache mounts and --parents COPY.
# 1st stage: build source code
FROM maven:3.9.0-eclipse-temurin-11 AS build
-COPY . /pkg
WORKDIR /pkg
+
+# Copy pom files first — layer is only invalidated when pom files change,
+# keeping the Maven cache mount warm across source-only changes.
+COPY --parents **/pom.xml ./
Review Comment:
Even after enabling `--parents`, this glob does not capture all Maven
descriptors: Dockerfile COPY globs are not recursive in the `.dockerignore`
sense, so the root `pom.xml` and nested module POMs such as
`hugegraph-store/hg-store-core/pom.xml` are not included in this pom-only
layer. That makes the dependency-cache layer incomplete for this multi-module
build.
##########
hugegraph-server/Dockerfile:
##########
@@ -16,18 +16,24 @@
#
# Dockerfile for HugeGraph Server
+# NOTE: Build with DOCKER_BUILDKIT=1 to enable cache mounts and --parents COPY.
# 1st stage: build source code
FROM maven:3.9.0-eclipse-temurin-11 AS build
-COPY . /pkg
WORKDIR /pkg
+
+# Copy pom files first — layer is only invalidated when pom files change,
+# keeping the Maven cache mount warm across source-only changes.
+COPY --parents **/pom.xml ./
Review Comment:
Even after enabling `--parents`, this glob does not capture all Maven
descriptors: Dockerfile COPY globs are not recursive in the `.dockerignore`
sense, so the root `pom.xml` and nested module POMs such as
`hugegraph-server/hugegraph-core/pom.xml` are not included in this pom-only
layer. That makes the dependency-cache layer incomplete for this multi-module
build.
##########
hugegraph-server/Dockerfile-hstore:
##########
@@ -15,19 +15,25 @@
# limitations under the License.
#
-# Dockerfile for HugeGraph Server
+# Dockerfile for HugeGraph Server (hstore backend)
+# NOTE: Build with DOCKER_BUILDKIT=1 to enable cache mounts and --parents COPY.
# 1st stage: build source code
FROM maven:3.9.0-eclipse-temurin-11 AS build
-COPY . /pkg
WORKDIR /pkg
+
+# Copy pom files first — layer is only invalidated when pom files change,
+# keeping the Maven cache mount warm across source-only changes.
+COPY --parents **/pom.xml ./
Review Comment:
Even after enabling `--parents`, this glob does not capture all Maven
descriptors: Dockerfile COPY globs are not recursive in the `.dockerignore`
sense, so the root `pom.xml` and nested module POMs such as
`hugegraph-server/hugegraph-core/pom.xml` are not included in this pom-only
layer. That makes the dependency-cache layer incomplete for this multi-module
build.
##########
hugegraph-server/Dockerfile-hstore:
##########
@@ -41,23 +47,17 @@ LABEL maintainer="HugeGraph Docker Maintainers
<[email protected]>"
ENV JAVA_OPTS="-XX:+UnlockExperimentalVMOptions -XX:+UseContainerSupport
-XX:MaxRAMPercentage=50 -XshowSettings:vm" \
HUGEGRAPH_HOME="hugegraph-server"
-#COPY . /hugegraph/hugegraph-server
WORKDIR /hugegraph-server/
-# 1. Install environment and init HugeGraph Sever
-RUN set -x \
- && apt-get -q update \
+# 1. Install runtime dependencies and configure server
+RUN apt-get -q update \
&& apt-get -q install -y --no-install-recommends --no-install-suggests \
dumb-init \
procps \
curl \
lsof \
Review Comment:
This runtime image no longer installs a package that provides `crontab`, but
the bundled server scripts still support `start-hugegraph.sh -m true` by
calling `start-monitor.sh`, which invokes `crontab_append`. That optional
monitor path will now fail with `crontab: command not found`, changing runtime
behavior for users who enable it.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]