setup coverate report generation
This commit is contained in:
30
Dockerfile.coverage
Normal file
30
Dockerfile.coverage
Normal file
@ -0,0 +1,30 @@
|
||||
# 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"]
|
||||
Reference in New Issue
Block a user