# Multi-stage Dockerfile to build JSON-Java library (OSGi bundle) from source using Maven (IBM Java 8)
# Stage 1: Build with Maven (IBM Java 8)
FROM maven:3.9.15-ibmjava-8 AS builder
WORKDIR /build
# Copy pom and source to leverage Maven cache
COPY pom.xml .
COPY src ./src
# Build the project (includes tests)
RUN mvn -DskipTests=false clean package
# Stage 2: Runtime image. Use a runtime JDK with Java 8 support to run the artifact.
FROM maven:3.9.15-ibmjava-8
WORKDIR /app
# Copy the built artifact from the builder stage
COPY --from=builder /build/target/json-20251224.jar /app/json-20251224.jar
# Optional: create a simple logs dir
RUN mkdir -p /app/logs
# Default command: provide artifact info and keep container alive
CMD ["bash","-lc","echo Built artifact: /app/json-20251224.jar; sleep infinity"]