# Use pinned Maven image with SAPMachine JDK 25 FROM maven:3.9.14-sapmachine-25 AS build WORKDIR /workspace # Copy project files and build all modules COPY . . RUN mvn -B -DskipTests install # Runtime image FROM maven:3.9.14-sapmachine-25 WORKDIR /workspace # Copy the built artifacts from the builder stage COPY --from=build /workspace /workspace # Keep the container interactive with a shell; adjust as needed for actual runtime CMD ["bash"]
# Ignore IDE and build system files .git .gitignore target **/target .settings .idea .metadata *.log .DS_Store "}
Concerns: Runtime image copies the entire /workspace from the build stage, leading to a larger image; consider copying only built artifacts and using a lighter runtime base., CMD uses a shell for runtime; for a real application you should set a proper entrypoint to run the built artifact. Smoke [PASS]: java -version Smoke [PASS]: ls -la /workspace Smoke [PASS]: if find /workspace -name '*.jar' | head -n 1 >/dev/null 2>&1; then echo jar_exists; else echo no_jar; fi