# syntax=docker/dockerfile:1 # Build Guava from source using Maven FROM maven:eclipse-temurin-11 AS build WORKDIR /workspace # Copy Maven wrapper and project files COPY mvnw . COPY .mvn .mvn COPY pom.xml pom.xml COPY android/pom.xml android/pom.xml # Copy the rest of the source COPY . . # Build the root pom.xml (Guava core Jar). We skip tests and toolchains to be friendly to minimal environments. RUN ./mvnw -B -ntp -Dtoolchain.skip install -U -DskipTests=true -f pom.xml # (Optional) Android flavor is known to require Android SDK tooling; it is not built here to keep the image lean. # Final runtime image: provide a lightweight JRE with the built artifacts FROM eclipse-temurin:11-jre-slim WORKDIR /app # Copy the built artifacts from the builder stage COPY --from=build /workspace/target /app/target # A minimal entrypoint that allows inspecting the container; users can mount their own apps and run with -cp /app/target/guava-*.jar CMD ["bash"]
# syntax=docker/dockerfile:1 # Stage 1: Build Guava from source using Maven FROM maven:eclipse-temurin AS build WORKDIR /workspace # Copy Maven wrapper and project files COPY mvnw . COPY .mvn .mvn COPY pom.xml pom.xml COPY android/pom.xml android/pom.xml # Copy the rest of the source tree COPY . . # Build the project (skip tests and toolchains for compatibility) RUN ./mvnw -B -ntp -Dtoolchain.skip install -U -DskipTests=true -f pom.xml # Stage 2: Runtime image FROM eclipse-temurin:11-jre-slim AS runtime WORKDIR /app # Copy the built artifacts and source from the builder stage COPY --from=build /workspace /app # Entrypoint that will try to run the Guava jar if present; otherwise drop into a shell RUN bash -lc 'cat > /entrypoint.sh <<"EOS" #!/bin/sh set -e ARTIFACT=$(find /app -name "guava-*.jar" 2>/dev/null | head -n1) if [ -z "$ARTIFACT" ]; then echo "Guava jar not found in /app. Listing contents for debugging:" ls -la /app exec /bin/bash fi exec java -jar "$ARTIFACT" "$@" EOS ' RUN chmod +x /entrypoint.sh ENTRYPOINT ["/entrypoint.sh"]
eclipse-temurin (760 stars): Official Images for OpenJDK binaries built by Eclipse Temurin. maven (1666 stars): Apache Maven is a software project management and comprehension tool. jenkins/jnlp-agent-maven (10 stars): A JNLP-based agent with Maven 3 built in okteto/maven (0 stars): eclipse-mosquitto (1378 stars): Eclipse Mosquitto is an open source message broker which implements MQTT version jenkins4eval/jnlp-agent-maven (0 stars): rootpublic/eclipse-temurin (0 stars): eclipsefdn/www-eclipse-org (0 stars): chainguard/maven (0 stars): Build, ship and run secure software with Chainguard's low-to-zero CVE container localstack/java-maven-node-python (4 stars): Base image with pre-baked core infrastructure
Image maven:eclipse-temurin exists on Docker Hub.
# syntax=docker/dockerfile:1 # Stage 1: Build Guava from source using Maven FROM maven:eclipse-temurin AS build WORKDIR /workspace # Copy Maven wrapper and project files COPY mvnw . COPY .mvn .mvn COPY pom.xml pom.xml COPY android/pom.xml android/pom.xml # Copy the rest of the source tree COPY . . # Build the project (skip tests and toolchains for compatibility) RUN ./mvnw -B -ntp -Dtoolchain.skip install -U -DskipTests=true -f pom.xml # Stage 2: Runtime image FROM eclipse-temurin:11-jre-slim AS runtime WORKDIR /app # Copy the built artifacts and source from the builder stage COPY --from=build /workspace /app # Entry point to run a built Guava jar if present, else drop to shell RUN bash -lc 'cat > /entrypoint.sh <<"EOS" #!/bin/sh set -e ARTIFACT=$(find /app -name "guava-*.jar" 2>/dev/null | head -n1) if [ -z "$ARTIFACT" ]; then echo "Guava jar not found in /app. Listing contents for debugging:" ls -la /app exec /bin/bash fi exec java -jar "$ARTIFACT" "$@" EOS ' RUN chmod +x /entrypoint.sh ENTRYPOINT ["/entrypoint.sh"]
# syntax=docker/dockerfile:1 # Stage 1: Build Guava from source using Maven FROM maven:eclipse-temurin AS build WORKDIR /workspace # Copy Maven wrapper and project files COPY mvnw . COPY .mvn .mvn COPY pom.xml pom.xml COPY android/pom.xml android/pom.xml # Copy the rest of the source tree COPY . . # Build the project (skip tests and toolchains for compatibility) RUN ./mvnw -B -ntp -Dtoolchain.skip install -U -DskipTests=true -f pom.xml # Stage 2: Runtime image FROM eclipse-temurin:11-jre AS runtime WORKDIR /app # Copy the built artifacts and source from the builder stage COPY --from=build /workspace /app # Entrypoint to run a built Guava jar if present, else drop to shell RUN bash -lc 'cat > /entrypoint.sh <<"EOS" #!/bin/sh set -e ARTIFACT=$(find /app -name "guava-*.jar" 2>/dev/null | head -n1) if [ -z "$ARTIFACT" ]; then echo "Guava jar not found in /app. Listing contents for debugging:" ls -la /app exec /bin/bash fi exec java -jar "$ARTIFACT" "$@" EOS ' RUN chmod +x /entrypoint.sh ENTRYPOINT ["/entrypoint.sh"]
**/target **/.git **/.github **/.idea **/node_modules **/dist **/*.class **/*.jar.snap **/.DS_Store
#0 building with "default" instance using docker driver #1 [internal] load build definition from Dockerfile #1 transferring dockerfile: 1.08kB done #1 DONE 0.0s #2 resolve image config for docker-image://docker.io/docker/dockerfile:1 #2 DONE 5.6s #3 docker-image://docker.io/docker/dockerfile:1@sha256:b6afd42430b15f2d2a4c5a02b919e98a525b785b1aaff16747d2f623364e39b6 #3 resolve docker.io/docker/dockerfile:1@sha256:b6afd42430b15f2d2a4c5a02b919e98a525b785b1aaff16747d2f623364e39b6 done #3 CACHED Dockerfile:29 -------------------- 27 | RUN bash -lc 'cat > /entrypoint.sh <<"EOS" 28 | #!/bin/sh 29 | >>> set -e 30 | ARTIFACT=$(find /app -name "guava-*.jar" 2>/dev/null | head -n1) 31 | if [ -z "$ARTIFACT" ]; then -------------------- ERROR: failed to build: failed to solve: dockerfile parse error on line 29: unknown instruction: set (did you mean user?)
# syntax=docker/dockerfile:1 # Stage 1: Build Guava from source using Maven FROM maven:eclipse-temurin AS build WORKDIR /workspace # Copy Maven wrapper and project files COPY mvnw . COPY .mvn .mvn COPY pom.xml pom.xml COPY android/pom.xml android/pom.xml # Copy the rest of the source tree COPY . . # Build the project (skip tests and toolchains for compatibility) RUN ./mvnw -B -ntp -Dtoolchain.skip install -U -DskipTests=true -f pom.xml # Stage 2: Runtime image FROM maven:eclipse-temurin AS runtime WORKDIR /app # Copy the built artifacts from the builder stage COPY --from=build /workspace/target /app/target # Provide a simple shell as default command; users can run java -jar on the produced jars CMD ["bash"]
Status - VerifyBuild status: build_failed Key issues / concerns - Base image not pinned: base image 'maven:eclipse-temurin' is not pinned to a specific version (non-deterministic builds). - Runtime image inefficiency: The runtime stage uses the same Maven-based image instead of a lean JRE/runtime image. - Build context: Dockerfile copies the entire repository; add a .dockerignore to exclude unnecessary files to speed up builds. Build error details - Failing step (build 8/8): - RUN ./mvnw -B -ntp -Dtoolchain.skip install -U -DskipTests=true -f pom.xml - Exit code: 1 - Docker message: failed to build: process "/bin/sh -c ./mvnw -B -ntp -Dtoolchain.skip install -U -DskipTests=true -f pom.xml" did not complete successfully: exit code: 1 - Exact error message: - ERROR] Unknown lifecycle phase "/root/.m2". You must specify a valid lifecycle phase or a goal in the format <plugin-prefix>:<goal> or <plugin-group-id>:<plugin-artifact-id>[:<plugin-version>]:<goal>. Available lifecycle phases are: pre-clean, clean, post-clean, validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy, pre-site, site, post-site, site-deploy. -> [Help 1] - [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. - [ERROR] Re-run Maven using the -X switch to enable full debug logging. - [ERROR] For more information about the errors, please read the following articles: - [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/LifecyclePhaseNotFoundException - Missing packages or files: - No specific missing packages or files mentioned; error is a Maven lifecycle phase error, not a missing file. - Version / mismatch details: - Base image: maven:eclipse-temurin (Dockerfile builds from the Maven Eclipse Temurin image) - Maven version used by wrapper: Apache Maven 3.9.12 (wrapper path: .../apache-maven-3.9.12-bin/...) - Guava-related version in logs: Guava Maven Parent 999.0.0-HEAD-jre-SNAPSHOT Summary (actionable) - The build failed due to a Maven lifecycle phase error (Unknown lifecycle phase "/root/.m2"). Likely a misformatted Maven command or incorrect plugin/goal reference in pom.xml when running the wrapper. - To investigate: re-run with -e or -X for full stack trace. - Consider: - Pinning the base image tag (e.g., maven:eclipse-temurin-XX.YY) for determinism. - Using a lean runtime image instead of a Maven-based image. - Adding a .dockerignore to exclude repository-wide files from the build context.
Image maven:eclipse-temurin-11 NOT found on Docker Hub.
Image maven:3.9-eclipse-temurin-11 exists on Docker Hub.
# syntax=docker/dockerfile:1 # Stage 1: Build Guava from source using Maven FROM maven:3.9-eclipse-temurin-11 AS build WORKDIR /workspace # Copy Maven wrapper and project files COPY mvnw . COPY .mvn .mvn COPY pom.xml pom.xml COPY android/pom.xml android/pom.xml # Copy the rest of the source tree COPY . . # Build the project (skip tests and toolchains for compatibility) RUN ./mvnw -B -ntp -Dtoolchain.skip install -U -DskipTests=true -f pom.xml # Stage 2: Runtime image FROM eclipse-temurin:11-jre WORKDIR /app # Copy the built artifacts from the builder stage COPY --from=build /workspace/target /app/target # Provide a minimal entrypoint that lists artifacts or runs a jar if found ENTRYPOINT ["bash", "-lc", "if ls /app/target/*.jar >/dev/null 2>&1; then echo 'Jar found:'; ls -1 /app/target/*.jar; else echo 'No jar found in /app/target'; ls -la /app/target; fi"]
- Status: VerifyBuild status: build_failed
- High-level concerns
- ENTRYPOINT uses bash; /bin/bash may not exist in eclipse-temurin:11-jre runtime image. If missing, container startup will fail. Recommend /bin/sh or install bash.
- COPY android/pom.xml assumes android/pom.xml exists in build context; if missing, build will fail. Validate path or adjust Dockerfile.
- Copying the entire repository (COPY . .) could be optimized with a .dockerignore.
- Build error details
- Failing command/step
- Step: [build 8/8]
- Command: RUN ./mvnw -B -ntp -Dtoolchain.skip install -U -DskipTests=true -f pom.xml
- Exact error message and exit code
- Docker build error: failed to solve: process "/bin/sh -c ./mvnw -B -ntp -Dtoolchain.skip install -U -DskipTests=true -f pom.xml" did not complete successfully: exit code: 1
- Maven error during that step: Unknown lifecycle phase "/root/.m2". You must specify a valid lifecycle phase or a goal in the format <plugin-prefix>:<goal> or <plugin-group-id>:<plugin-artifact-id>[:<plugin-version>]:<goal>. Available lifecycle phases are: pre-clean, clean, post-clean, validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy, pre-site, site, post-site, site-deploy. -> [Help 1]
- Missing packages/files
- No specific missing package/file listed. Issue is a Maven lifecycle-phase parsing error, not a missing artifact.
- Version / environment info
- Build context uses: Maven 3.9 (maven:3.9-eclipse-temurin-11) with Eclipse Temurin 11 JRE
- Project reactor shows: Guava Maven Parent 999.0.0-HEAD-jre-SNAPSHOT
- Failure occurs during the Guava parent/module install step, not due to an explicit missing artifact
- Error path includes: /root/.m2 (Maven local repo) as part of the lifecycle-phase parsing issue# syntax=docker/dockerfile:1 # Stage 1: Build Guava from source using Maven FROM maven:3.9-eclipse-temurin-11 AS build WORKDIR /workspace # Copy Maven wrapper (optional) and project files COPY mvnw . COPY .mvn .mvn COPY pom.xml pom.xml # Copy the rest of the source tree (excluding android to avoid Android SDK tooling in this minimal build) COPY android/pom.xml android/pom.xml COPY android android COPY . . # Build the project (exclude the Android module to keep the build lean; use reactor to build other modules) RUN mvn -B -ntp -Dtoolchain.skip install -U -DskipTests=true -pl '!android' -am -f pom.xml # Stage 2: Runtime image FROM eclipse-temurin:11-jre WORKDIR /app # Copy the built artifacts from the builder stage (and the rest of the workspace for inspection) COPY --from=build /workspace /workspace # Provide a minimal entrypoint that lists built jars, or drops to a shell for exploration ENTRYPOINT ["bash", "-lc", "if ls /workspace/**/target/*.jar >/dev/null 2>&1; then echo 'JARs built:'; find /workspace -name '*.jar' -print; else echo 'No jar found in workspace; listing root contents:'; ls -la /workspace; fi"]