roncoo-roncoo-pay
SUCCESS
6m 13s
History Source
SummaryIterations3Transcript9Dockerfile
Dockerfile29 lines · 1063 chars
# 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\""]