From 1df19fd955eb951f5d31fb205963b2f4e794c039 Mon Sep 17 00:00:00 2001 From: Szymon Szukalski Date: Thu, 25 Jul 2024 11:56:13 +1000 Subject: Separate Docker Compose services for build, test, run Refactor Docker Compose setup to include distinct services for building, testing, and running the application. Use separate Dockerfiles and configurations for each phase to isolate concerns and improve workflow. Quiet down the maven logs and set log levels to WARN so there is less noise in the logs. Update README file with information on running the project. --- Dockerfile.test | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 Dockerfile.test (limited to 'Dockerfile.test') diff --git a/Dockerfile.test b/Dockerfile.test new file mode 100644 index 0000000..9a82cc5 --- /dev/null +++ b/Dockerfile.test @@ -0,0 +1,15 @@ +# Stage 1: BUILD +FROM maven:3.8.5-openjdk-17 AS build +WORKDIR /app +COPY mvnw pom.xml ./ +COPY .mvn .mvn +COPY src src +RUN chmod +x mvnw +RUN ./mvnw clean package -q -Dmaven.test.skip=true + +# Stage 2: TEST +FROM maven:3.8.5-openjdk-17 AS test +WORKDIR /app +COPY --from=build /app /app +RUN chmod +x mvnw +CMD ["./mvnw", "test", "-P", "test", "-q"] \ No newline at end of file -- cgit v1.2.3