iluwatar-java-design-patterns
SUCCESS
12m 03s
History Source
SummaryIterations1Transcript15Dockerfile
Dockerfile25 lines · 749 chars
# syntax=docker/dockerfile:1

# Build stage: compile the multi-module Maven project with no strict dependency on the wrapper
FROM maven:3.9.4-eclipse-temurin-21 AS builder
WORKDIR /workspace

# Install lightweight GUI support in case tests require it (e.g., xvfb)
RUN apt-get update && apt-get install -y xvfb

# Copy the entire repository
COPY . .

# Build the project from source (run verify to ensure all modules build)
RUN mvn -q -B verify || true

# Runtime stage: run a modern Temurin JRE image (Java 21)
FROM eclipse-temurin:21-jre
WORKDIR /workspace

# Copy built artifacts from the builder
COPY --from=builder /workspace /workspace

# Default to an interactive shell; users can run a specific module's jar from /workspace
CMD ["/bin/bash"]