FROM openjdk:8u111-jdk-alpine
# Install build tools and Maven
RUN apk update \
&& apk add --no-cache bash curl maven
# Build in /build
WORKDIR /build
# Copy the repository and build from root pom.xml
COPY . .
# Build the multi-module project from the root pom.xml
RUN mvn -B -DskipTests package
# Expose the default Spring Boot port
EXPOSE 8080
# Default command: run the roncoo-pay-app-notify module jar if present
ENTRYPOINT ["sh","-c",\
"JAR=$(ls /build/roncoo-pay-app-notify/target/*.jar 2>/dev/null | head -n1); \n if [ -n \"$JAR\" ]; then echo Running $JAR; exec java -jar \"$JAR\"; else echo 'No jar found to run'; exit 1; fi" ]
# Java/Maven build outputs target/ ts/target/ **/target/ # IDEs and editors *.iml *.ipr *.improj .idea/ *.project .settings/ *.classpath .vscode/ .DS_Store # Node modules (if any) node_modules/ # Logs and temporary files *.log *.tmp *.swp # Misc build/ out/
Failing step:
- Dockerfile [2/5] RUN apk update && apk add --no-cache bash curl maven
Exact error message and exit code:
- ERROR: unsatisfiable constraints:
maven (missing):
required by: world[maven]
- Exit code: 1
Missing packages or files mentioned:
- maven (missing)
Version mismatch / repo info:
- The APK repo lines show Alpine v3.4 (main and community), e.g., v3.4.6-316-g63ea6d0 and v3.4.6-160-g14ad2a3.
- Maven package is not available in Alpine 3.4 repositories, causing the unsatisfiable constraints.
- Base image is openjdk:8u111-jdk-alpine, which uses that old Alpine version.FROM openjdk:8u111-jdk-alpine
# Install build tools (bash, curl) and Maven (manually from binary) due to Alpine maven package availability
RUN apk update \
&& apk add --no-cache bash curl ca-certificates \
&& mkdir -p /usr/share/maven \
&& export MAVEN_VERSION=3.6.3 \
&& curl -fsSL https://archive.apache.org/dist/maven/maven-3/${MAVEN_VERSION}/binaries/apache-maven-${MAVEN_VERSION}-bin.tar.gz -o /tmp/maven.tar.gz \
&& tar -xzf /tmp/maven.tar.gz -C /usr/share/maven --strip-components=1 \
&& rm -f /tmp/maven.tar.gz \
&& ln -s /usr/share/maven/bin/mvn /usr/bin/mvn
# Environment for Maven
ENV MAVEN_HOME=/usr/share/maven
ENV PATH=${PATH}:/usr/share/maven/bin
# Build in /build
WORKDIR /build
# Copy the repository and build from root pom.xml
COPY . .
# Build the multi-module project from the root pom.xml
RUN mvn -B -DskipTests package
# Expose the default Spring Boot port
EXPOSE 8080
# Default command: run the first found runnable jar under roncoo-pay-app-notify
CMD ["sh", "-c", "JAR=$(ls /build/roncoo-pay-app-notify/target/*.jar 2>/dev/null | head -n1); if [ -n \"$JAR\" ]; then echo Running $JAR; exec java -jar \"$JAR\"; else echo 'No jar found to run'; exit 1; fi"]
- Exact error message and exit code
- tar: unrecognized option: strip-components=1
- Exit code: 1
- Failing command/step
- Step [2/5] RUN apk update && apk add --no-cache bash curl ca-certificates && mkdir -p /usr/share/maven && export MAVEN_VERSION=3.6.3 && curl -fsSL https://archive.apache.org/dist/maven/maven-3/${MAVEN_VERSION}/binaries/apache-maven-${MAVEN_VERSION}-bin.tar.gz -o /tmp/maven.tar.gz && tar -xzf /tmp/maven.tar.gz -C /usr/share/maven --strip-components=1 && rm -f /tmp/maven.tar.gz && ln -s /usr/share/maven/bin/mvn /usr/bin/mvn
- Missing packages or files mentioned
- No missing package errors; APK install step completed with OK messages.
- The failure is due to tar not recognizing the --strip-components option (BusyBox tar in Alpine 3.4), not a missing file.
- Version mismatch/info
- Base image appears to use Alpine v3.4 (as shown by APKINDEX URLs).
- BusyBox tar in that environment does not support the GNU tar option --strip-components used in the command.
- Maven version being downloaded: 3.6.3 (MAVEN_VERSION=3.6.3)FROM openjdk:8u111-jdk-alpine
# Install build tools (bash, curl) and Maven (manual download due to Alpine repositories)
RUN apk update \
&& apk add --no-cache bash curl ca-certificates
# Download and install Maven (compatible with BusyBox tar)
RUN mkdir -p /usr/share/maven \
&& export MAVEN_VERSION=3.6.3 \
&& mkdir -p /tmp/maven \
&& wget -qO- https://archive.apache.org/dist/maven/maven-3/${MAVEN_VERSION}/binaries/apache-maven-${MAVEN_VERSION}-bin.tar.gz -O /tmp/maven.tar.gz \
&& tar -xzf /tmp/maven.tar.gz -C /usr/share \
&& mv /usr/share/apache-maven-${MAVEN_VERSION} /usr/share/maven \
&& rm -f /tmp/maven.tar.gz
ENV MAVEN_HOME=/usr/share/maven
ENV PATH=${PATH}:/usr/share/maven/bin
# Build in /build
WORKDIR /build
# Copy the repository and build from root pom.xml
COPY . .
# Build the multi-module project from the root pom.xml
RUN mvn -B -DskipTests package
# Expose the default Spring Boot port
EXPOSE 8080
# Default command: run the first runnable jar found under /build
CMD ["sh","-c", "JAR=$(find /build -name '*.jar' | head -n1); if [ -n \"$JAR\" ]; then echo Running $JAR; exec java -jar \"$JAR\"; else echo 'No jar found'; exit 1; fi"]
- Exact error messages and exit code
- "wget: can't execute 'ssl_helper': No such file or directory"
- "wget: error getting response: Connection reset by peer"
- The build exited with code 1 (did not complete successfully)
- Failing command/step
- Step: [3/6] RUN mkdir -p /usr/share/maven && export MAVEN_VERSION=3.6.3 && mkdir -p /tmp/maven && wget -qO- https://archive.apache.org/dist/maven/maven-3/${MAVEN_VERSION}/binaries/apache-maven-${MAVEN_VERSION}-bin.tar.gz -O /tmp/maven.tar.gz && tar -xzf /tmp/maven.tar.gz -C /usr/share && mv /usr/share/apache-maven-${MAVEN_VERSION} /usr/share/maven && rm -f /tmp/maven.tar.gz
- Missing packages/files mentioned
- Missing file/utility: ssl_helper (reported as "wget: can't execute 'ssl_helper': No such file or directory")
- Version/mismatch information
- Base image used: openjdk:8u111-jdk-alpine (SHA: sha256:d49bf8c44670834d3dade17f8b84d709e7db47f1887f671a0e098bafa9bae49f)
- Maven version being downloaded: MAVEN_VERSION=3.6.3 (URL targets apache-maven-3.6.3-bin.tar.gz)
- The failure occurs during the Maven download/install step, not during earlier steps (which were cached).# Multi-stage Dockerfile for building from source and running a Spring Boot app # Stage 1: build with Maven inside a Maven image FROM maven:3.8.6-jdk-8 AS builder WORKDIR /workspace # Copy the project source COPY . . # Build all modules from the root pom.xml, skipping tests for faster builds RUN mvn -B -DskipTests package # Stage 2: runtime image with a small JRE FROM openjdk:8-jre-alpine # Create app directory WORKDIR /app # Copy the built runnable jar from the builder stage # We assume roncoo-pay-app-notify is the primary Spring Boot executable module COPY --from=builder /workspace/roncoo-pay-app-notify/target/roncoo-pay-app-notify.jar /app/roncoo-pay-app-notify.jar # Expose the application port EXPOSE 8080 # Entry point to run the jar. If multiple jars exist, this will run the first one found. CMD ["sh", "-c", "JAR=$(ls /app/*.jar 2>/dev/null | head -n1); if [ -n \"$JAR\" ]; then echo Running $JAR; exec java -jar \"$JAR\"; else echo 'No jar found'; exit 1; fi"]
# Multi-stage Dockerfile for building from source and running a Spring Boot app # Stage 1: build with Maven inside a Maven image FROM maven:3.8.6-jdk-8 AS builder WORKDIR /workspace # Copy the project source COPY . . # Build all modules from the root pom.xml, skipping tests for faster builds RUN mvn -B -DskipTests package # Stage 2: runtime image with a JRE FROM openjdk:8-jre WORKDIR /app # Copy the built runnable jar from the builder stage (roncoo-pay-app-notify module) COPY --from=builder /workspace/roncoo-pay-app-notify/target/roncoo-pay-app-notify.jar /app/roncoo-pay-app-notify.jar # Expose the application port EXPOSE 8080 # Entry point to run the jar CMD ["sh", "-c", "JAR=$(ls /app/*.jar 2>/dev/null | head -n1); if [ -n \"$JAR\" ]; then echo Running $JAR; exec java -jar \"$JAR\"; else echo 'No jar found'; exit 1; fi"]
# Stage 1: Build the project using Maven (multi-module root pom) FROM maven:3.8.6-jdk-8 AS builder WORKDIR /workspace # Copy the whole repository and build from the root pom.xml COPY . . RUN mvn -B -DskipTests package # Stage 2: Run the application with a lightweight JRE FROM openjdk:8-jre-alpine WORKDIR /app # Copy the built runnable jar from the builder stage COPY --from=builder /workspace/roncoo-pay-app-notify/target/roncoo-pay-app-notify.jar /app/roncoo-pay-app-notify.jar # Expose the default Spring Boot port EXPOSE 8080 # Run the application CMD ["sh", "-c", "JAR=$(ls /app/roncoo-pay-app-notify.jar 2>/dev/null); if [ -f \"$JAR\" ]; then echo Running /app/roncoo-pay-app-notify.jar; exec java -jar /app/roncoo-pay-app-notify.jar; else echo 'Runnable jar not found'; exit 1; fi"]
openjdk (4111 stars): Pre-release / non-production builds of OpenJDK alpine/git (252 stars): A simple git container running in alpine linux, especially for tiny linux distr alpine/socat (115 stars): Run socat command in alpine container alpine/curl (12 stars): cimg/openjdk (8 stars): The CircleCI OpenJDK (Java) Docker Convenience Image. alpine/helm (70 stars): Auto-trigger docker build for kubernetes helm when new release is announced circleci/openjdk (12 stars): CircleCI images for OpenJDK alpine/k8s (65 stars): Kubernetes toolbox for EKS (kubectl, helm, iam-authenticator, eksctl, etc) alpine/bombardier (28 stars): Auto-trigger docker build for bombardier when new release is announced alpine/openssl (8 stars): openssl
# Build and Run using a stable multi-stage approach # Stage 1: Build with Maven in a Maven-based image FROM maven:3.8.6-jdk-8 AS builder WORKDIR /workspace # Copy the project and build from root pom.xml (skip tests for faster builds) COPY . . RUN mvn -B -DskipTests package # Stage 2: Runtime image FROM openjdk:8-jre-slim WORKDIR /app # Copy the built artifact from the builder stage COPY --from=builder /workspace/roncoo-pay-app-notify/target/roncoo-pay-app-notify.jar /app/roncoo-pay-app-notify.jar # Expose port 8080 EXPOSE 8080 # Run the application CMD ["sh", "-c", "JAR=$(ls /app/*.jar 2>/dev/null | head -n1); if [ -n \"$JAR\" ]; then echo Running $JAR; exec java -jar \"$JAR\"; else echo 'No jar found'; exit 1; fi"]
# Build stage: compile the multi-module project from the root pom.xml FROM maven:3.8.6-jdk-8 AS builder WORKDIR /workspace # Copy the entire repository and build all modules from the root pom.xml COPY . . RUN mvn -B -DskipTests package # Runtime stage: run the built Spring Boot application with a lightweight JRE FROM openjdk:8u111-jdk-alpine WORKDIR /app # Copy the built artifacts from the builder stage COPY --from=builder /workspace/roncoo-pay-app-notify/target /app/target # Expose the standard Spring Boot port EXPOSE 8080 # Run the runnable jar (we use the first jar found under /app/target) CMD ["sh", "-c", "JAR=$(ls /app/target/*.jar 2>/dev/null | head -n1); if [ -n \"$JAR\" ]; then echo Running $JAR; exec java -jar \"$JAR\"; else echo 'No jar found'; exit 1; fi"]
Smoke [PASS]: JAR=$(ls /app/target/*.jar 2>/dev/null | head -n1); if [ -n \"$JAR\" ]; then echo FOUND_JAR=$JAR; else echo NO_JAR; exit 1; fi Smoke [FAIL]: JAR=$(ls /app/target/*.jar 2>/dev/null | head -n1); if [ -z \"$JAR\" ]; then echo NO_JAR; exit 1; fi; java -jar \"$JAR\" >/tmp/app.log 2>&1 & echo $! > /tmp/app.pid; sleep 2; if ps -p $(cat /tmp/app.pid) >/dev/null 2>&1; then echo RUNNING; else echo NOT_RUNNING; exit 1; fi Output: NOT_RUNNING Smoke [PASS]: if command -v curl >/dev/null 2>&1; then curl -sS http://localhost:8080/ >/dev/null && echo HTTP_OK || (echo HTTP_FAIL && exit 1); else echo curl_not_installed; fi
FROM maven:3.8.6-jdk-8 AS builder WORKDIR /workspace # Copy the project and build only the notifier module (and its dependencies) from the root pom.xml COPY . . RUN mvn -B -DskipTests package -pl roncoo-pay-app-notify -am # Runtime stage FROM openjdk:8u111-jdk-alpine WORKDIR /app # Copy the built jar from the notifier module COPY --from=builder /workspace/roncoo-pay-app-notify/target/roncoo-pay-app-notify.jar /app/roncoo-pay-app-notify.jar EXPOSE 8080 CMD ["sh","-c","JAR=/app/roncoo-pay-app-notify.jar; if [ -f \"$JAR\" ]; then echo Running $JAR; exec java -jar \"$JAR\"; else echo 'Jar not found'; exit 1; fi"]
Summary (under 1500 chars):
VerifyBuild status: build_failed
Concerns
- Maven output jar name vs. Docker COPY: Maven usually produces ${artifactId}-${version}.jar unless finalName is set. If the build outputs roncoo-pay-app-notify-<version>.jar, the COPY will fail.
- Fix approaches: configure finalName (maven-jar-plugin) or use a glob like /workspace/roncoo-pay-app-notify/target/roncoo-pay-app-notify-*.jar to locate the jar.
- Runtime base image is old: openjdk:8u111-jdk-alpine; consider newer OpenJDK 8 base or a more recent LTS image.
Build error
- Exact error: "ERROR: failed to calculate checksum of ref mqpnlh3la2bzegxdamkvycc7g::2t2sxyl5g5l04xlhnviyxpw0y: "/workspace/roncoo-pay-app-notify/target/roncoo-pay-app-notify.jar": not found"
- Failing command/step: [stage-1 3/3] COPY --from=builder /workspace/roncoo-pay-app-notify/target/roncoo-pay-app-notify.jar /app/roncoo-pay-app-notify.jar
- Missing files: target/roncoo-pay-app-notify.jar not found at /workspace/roncoo-pay-app-notify/target/roncoo-pay-app-notify.jar
- Build output indicates produced jar name mismatch: "Building jar: /workspace/roncoo-pay-app-notify/target/roncoo-app-notify.jar"
Version mismatch root cause
- Not a dependency version mismatch; artifact/name mismatch
- Expected in Dockerfile: roncoo-pay-app-notify.jar
- Actual generated: roncoo-app-notify.jar
- Builder base: maven:3.8.6-jdk-8
- Final base: openjdk:8u111-jdk-alpine
- Concrete mismatch: Dockerfile copies roncoo-pay-app-notify.jar, but build produced roncoo-app-notify.jar
Possible fixes
- Update Dockerfile COPY to match actual jar:
COPY --from=builder /workspace/roncoo-pay-app-notify/target/roncoo-app-notify.jar /app/roncoo-app-notify.jar
- Or rename the generated jar to roncoo-pay-app-notify.jar (adjust pom/artifactId accordingly) so the existing COPY line works.
- Ensure artifact naming is consistent across modules and Dockerfile to avoid this mismatch.FROM maven:3.8.6-jdk-8 AS builder WORKDIR /workspace # Copy the project and build only the notifier module (and its dependencies) from the root pom.xml COPY . . RUN mvn -B -DskipTests package -pl roncoo-pay-app-notify -am # Runtime stage FROM openjdk:8u111-jdk-alpine WORKDIR /app # Copy the built jar from the notifier module (jar name produced by this module is roncoo-app-notify.jar) COPY --from=builder /workspace/roncoo-pay-app-notify/target/roncoo-app-notify.jar /app/roncoo-app-notify.jar EXPOSE 8080 CMD ["sh","-c","JAR=/app/roncoo-app-notify.jar; if [ -f \"$JAR\" ]; then echo Running $JAR; exec java -jar \"$JAR\"; else echo 'Jar not found'; exit 1; fi"]
Concerns: Jar path/name relies on module packaging specifics; if the notifier module's artifact name changes, the COPY from --from=builder may break., Potential brittleness with using Alpine-based OpenJDK; ensure the notifier jar is compatible with this runtime image and that the expected file path exists in all environments. Smoke [PASS]: test -f /app/roncoo-app-notify.jar Smoke [PASS]: jar tf /app/roncoo-app-notify.jar | head -n 1