diff --git a/Dockerfile.multi-stage b/Dockerfile.multi-stage index df26b11..8a67527 100644 --- a/Dockerfile.multi-stage +++ b/Dockerfile.multi-stage @@ -2,12 +2,18 @@ # # SPDX-License-Identifier: Apache-2.0 +# This multi-stage Dockerfile is used to build a Java application with Maven and run it with a JRE. +# It skips the tests during the build process and uses a slim JRE image for the final container. +# USE WITH CAUTION: This Dockerfile is intended for demonstration purposes only and should be adjusted to your needs. +# The final container is started with a non-root user. + + FROM maven:3.9-eclipse-temurin-17-alpine AS build RUN mkdir -p /usr/app WORKDIR /usr/app ADD . /usr/app -RUN mvn -f /usr/app/pom.xml clean package +RUN mvn -f /usr/app/pom.xml clean package -DskipTests FROM eclipse-temurin:17-jre-alpine diff --git a/README.md b/README.md index b89bf2d..cefb42c 100644 --- a/README.md +++ b/README.md @@ -57,7 +57,8 @@ This will build the image and tag it as `jumper:latest`. ### Multi-stage Docker build -Alternatively, you can use the multi-stage Docker build to build the image. This will build the application in a Maven container and then copy the resulting artifacts into a smaller container. To build the image, run: +Alternatively, you can use the multi-stage Docker build to build the image. This will build the application in a Maven container and then copy the resulting artifacts into a smaller container. +**It will, however, skip the Maven unit test stage due to some issues with Testcontainers.** To build the image, run: ```bash docker build --platform linux/amd64 -t jumper -f Dockerfile.multi-stage .