# Multi-stage Dockerfile to build and run roncoo-pay web boss app from source # Builder stage: compile the project (builds the module roncoo-pay-web-boss and its dependencies) FROM maven:3.6.3-jdk-8-slim AS builder WORKDIR /build # Copy the entire project into the build context COPY . . # Build the roncoo-pay-web-boss module (skip tests to speed up the build) RUN mvn -DskipTests -pl roncoo-pay-web-boss -am package # Runtime stage: run the generated Spring Boot executable jar FROM openjdk:8-jre-slim WORKDIR /app # Copy the built artifacts from the builder COPY --from=builder /build/roncoo-pay-web-boss/target /app/target # Expose typical Spring Boot port EXPOSE 8080 # Start the application by discovering the jar in /app/target CMD ["bash", "-lc", "JAR=$(ls /app/target/roncoo-pay-web-boss-*.jar 2>/dev/null | head -n 1); if [ -z \"$JAR\" ]; then echo 'Jar not found'; exit 1; fi; exec java -jar \"$JAR\""]
# Multi-stage Dockerfile to build and run roncoo-pay web boss app from source # Builder stage: compile the project (builds the module roncoo-pay-web-boss and its dependencies) FROM maven:3.6.3-jdk-8-slim AS builder WORKDIR /build # Copy the entire project into the build context COPY . . # Build the roncoo-pay-web-boss module (skip tests to speed up the build) RUN mvn -DskipTests -pl roncoo-pay-web-boss -am package # Runtime stage: run the generated Spring Boot executable jar FROM openjdk:8-jre-alpine WORKDIR /app # Copy the built artifacts from the builder COPY --from=builder /build/roncoo-pay-web-boss/target /app/target # Expose typical Spring Boot port EXPOSE 8080 # Start the application by discovering the jar in /app/target CMD ["sh", "-lc", "JAR=$(ls /app/target/roncoo-pay-web-boss-*.jar 2>/dev/null | head -n 1); if [ -z \"$JAR\" ]; then echo 'Jar not found'; exit 1; fi; exec java -jar \"$JAR\""]
# Multi-stage Dockerfile to build and run roncoo-pay web boss app from source # Builder stage: compile the project (builds the module roncoo-pay-web-boss and its dependencies) FROM maven:3.6.3-jdk-8-slim AS builder WORKDIR /build # Copy the entire project into the build context COPY . . # Build the roncoo-pay-web-boss module (skip tests to speed up the build) RUN mvn -DskipTests -pl roncoo-pay-web-boss -am package # Runtime stage: run the generated Spring Boot executable jar FROM openjdk:8-jre-slim WORKDIR /app # Copy the built artifacts from the builder COPY --from=builder /build/roncoo-pay-web-boss/target /app/target # Expose typical Spring Boot port EXPOSE 8080 # Start the application by discovering the jar in /app/target CMD ["sh", "-lc", "JAR=$(ls /app/target/roncoo-pay-web-boss-*.jar 2>/dev/null | head -n 1); if [ -z \"$JAR\" ]; then echo 'Jar not found'; exit 1; fi; exec java -jar \"$JAR\""]
# Multi-stage Dockerfile to build and run roncoo-pay web boss app from source # Builder stage: compile the project (builds the module roncoo-pay-web-boss and its dependencies) FROM maven:3.6.3-jdk-8-slim AS builder WORKDIR /build # Copy the entire project into the build context COPY . . # Build the roncoo-pay-web-boss module (skip tests to speed up the build) RUN mvn -DskipTests -pl roncoo-pay-web-boss -am package # Runtime stage: run the generated Spring Boot executable jar FROM eclipse-temurin:8-jre WORKDIR /app # Copy the built artifacts from the builder COPY --from=builder /build/roncoo-pay-web-boss/target /app/target # Expose typical Spring Boot port EXPOSE 8080 # Start the application by discovering the jar in /app/target CMD ["bash", "-lc", "JAR=$(ls /app/target/roncoo-pay-web-boss-*.jar 2>/dev/null | head -n 1); if [ -z \"$JAR\" ]; then echo 'Jar not found'; exit 1; fi; exec java -jar \"$JAR\""]
# Exclude build output and VCS metadata **/target/ **/node_modules/ .git .gitignore *.log *.tmp *.swp *.swo *.bak *.class *.idea/ *.iml .DS_Store # Optional: exclude local environment folders .vscode/ .env
Concerns: CMD relies on jar name pattern roncoo-pay-web-boss-*.jar which may not match if the Maven artifact is named differently; ensure the build actually produces a jar with this prefix, No HEALTHCHECK or explicit readiness check; container startup health is verified only by presence of the jar and Java runtime in smoke tests
Smoke [FAIL]: JAR=$(ls /app/target/roncoo-pay-web-boss-*.jar 2>/dev/null | head -n 1); if [ -z "$JAR" ]; then echo 'Jar not found'; exit 1; fi; echo 'Jar: ' $JAR
Output: Jar not found
Smoke [PASS]: java -version
Smoke [PASS]: test -d /app/target && echo 'Target directory present' || { echo 'Target directory missing'; exit 1; }# Multi-stage Dockerfile to build and run roncoo-pay web boss app from source # Builder stage: compile the project (builds the module roncoo-pay-web-boss and its dependencies) FROM maven:3.6.3-jdk-8-slim AS builder WORKDIR /build # Copy the entire project into the build context COPY . . # Build the roncoo-pay-web-boss module (skip tests to speed up the build) RUN mvn -DskipTests -pl roncoo-pay-web-boss -am package # Runtime stage: run the generated Spring Boot executable jar FROM eclipse-temurin:8-jre WORKDIR /app # Copy the built artifacts from the builder COPY --from=builder /build/roncoo-pay-web-boss/target /app/target # Expose typical Spring Boot port EXPOSE 8080 # Start the application by discovering the jar in /app/target CMD ["bash", "-lc", "JAR=$(ls /app/target/roncoo-pay-web-boss-*.jar 2>/dev/null | head -n 1); if [ -z \"$JAR\" ]; then echo 'Jar not found'; exit 1; fi; exec java -jar \"$JAR\""]
# Multi-stage Dockerfile to build and run roncoo-pay web boss app from source # Builder stage: compile the project (builds the module roncoo-pay-web-boss and its dependencies) FROM maven:3.6.3-jdk-8-slim AS builder WORKDIR /build # Copy the entire project into the build context COPY . . # Build the roncoo-pay-web-boss module (skip tests to speed up the build) RUN mvn -DskipTests -pl roncoo-pay-web-boss -am package # Collect all built jars to a common directory RUN mkdir -p /build/all-targets RUN bash -lc 'for f in $(find /build -name "*.jar" -path "*/target/*.jar" -type f); do cp "$f" /build/all-targets/; done' || true # Runtime stage: run the built artifacts FROM eclipse-temurin:8-jre WORKDIR /app # Copy jars from the builder COPY --from=builder /build/all-targets /app/target # Expose typical Spring Boot port EXPOSE 8080 # Start the application by discovering the jar in /app/target CMD ["bash", "-lc", "JAR=$(ls /app/target/*.jar 2>/dev/null | head -n 1); if [ -z \"$JAR\" ]; then echo 'Jar not found'; exit 1; fi; exec java -jar \"$JAR\""]
Concerns: If no jar is produced, the runtime will fail with 'Jar not found' at startup; the build step uses || true which can mask build failures., COPY --from=builder /build/all-targets /app/target will copy nothing if the jar collection step fails; this results in a non-runnable image unless a jar exists., Using Java 8 (maven:3.6.3-jdk-8-slim and eclipse-temurin:8-jre) may be outdated for security and feature reasons; consider upgrading to a newer LTS Java version if feasible. Smoke [PASS]: set -e; jar=$(ls /app/target/*.jar 2>/dev/null | head -n 1); if [ -z "$jar" ]; then echo 'Jar not found'; exit 1; fi; echo Found_jar: $jar Smoke [PASS]: java -version Smoke [PASS]: ls -la /app/target 2>/dev/null || true