Files
jaxwsdemo/Dockerfile.coverage

31 lines
637 B
Docker

# Multi-stage build for code coverage
FROM maven:3.8.6-openjdk-8 AS builder
# Set working directory
WORKDIR /app
# Copy pom.xml and src
COPY pom.xml .
COPY src ./src
# Build with tests
RUN mvn clean package -DskipTests=false
# Create a separate stage for running tests with coverage
FROM maven:3.8.6-openjdk-8
# Set working directory
WORKDIR /app
# Copy the built project
COPY --from=builder /app/target/*.war /app/app.war
# Install dependencies for coverage reporting
RUN apt-get update && apt-get install -y wget unzip
# Create a script to run tests with coverage
COPY scripts/ .
# Run tests with coverage
CMD ["mvn", "test"]