apache-commons-csv
SUCCESS
3m 43s
History Source
SummaryIterations1Transcript3Dockerfile
Dockerfile21 lines · 716 chars
# Multi-stage build to compile the project with Maven and provide a minimal runtime image
FROM maven:3.8.6-jdk-8 AS builder
WORKDIR /build

# Copy the pom and the source code to leverage Docker layer caching for dependencies
COPY pom.xml ./
COPY src ./src

# Build the project from source (skipping tests for a faster image build)
RUN mvn -B -DskipTests package

# Runtime stage
FROM eclipse-temurin:8-jre
WORKDIR /app

# Copy the built artifact from the builder stage
COPY --from=builder /build/target/commons-csv-1.14.2-SNAPSHOT.jar /app/commons-csv-1.14.2-SNAPSHOT.jar

# Provide a simple runtime behavior
CMD ["sh", "-lc", "echo 'Apache Commons CSV built: /app/commons-csv-1.14.2-SNAPSHOT.jar'; sleep infinity"]