# Stage 1: Build the ZXing multi-module project from source
FROM maven:3.9-ibm-semeru-21-noble AS builder
# Working directory for the build
WORKDIR /workspace
# Copy the repository sources into the build container
COPY . .
# Build the project from source (skip tests for a faster build; you can enable tests if needed)
RUN mvn -nsu -B install -DskipTests
# Stage 2: Minimal runtime image containing the built artifacts
FROM eclipse-temurin:21-jre-jammy AS runtime
# Prepare a directory to hold ZXing artifacts
WORKDIR /opt/zxing
# Copy all built artifacts from the builder stage
COPY --from=builder /workspace /opt/zxing/workspace
# Default command: drop into a shell so users can inspect the artifacts or run simple java commands
CMD ["bash"]