From 24b59c3cc7d41212946654ebbee49c48aca874a0 Mon Sep 17 00:00:00 2001 From: Michael Winsauer Date: Sat, 10 Nov 2018 03:30:25 +0100 Subject: [PATCH] Use multi-stage build Dockerfile for Twitter Service --- service-twitter/Dockerfile | 16 +++++++++++----- service-twitter/pom.xml | 2 +- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/service-twitter/Dockerfile b/service-twitter/Dockerfile index 5a811e5..26f882d 100644 --- a/service-twitter/Dockerfile +++ b/service-twitter/Dockerfile @@ -1,13 +1,19 @@ FROM openjdk:11-slim MAINTAINER Michael Winsauer +COPY . /build + +WORKDIR /build +RUN ["./mvnw", "-q", "-Dmaven.test.skip", "package"] + + +FROM openjdk:11-jre-slim +MAINTAINER Michael Winsauer + VOLUME /tmp EXPOSE 8084 -COPY . /app +COPY --from=0 /build/target/service-twitter-0.1.0-SNAPSHOT.jar /app/service-twitter.jar WORKDIR /app -RUN ["./mvnw", "package", "-Dmaven.test.skip"] - -WORKDIR /app/target -ENTRYPOINT ["java", "-Djava.security.egd=file:/dev/./urandom", "-jar", "service-twitter-0.0.1-SNAPSHOT.jar"] +ENTRYPOINT ["java", "-Djava.security.egd=file:/dev/./urandom", "-jar", "service-twitter.jar"] diff --git a/service-twitter/pom.xml b/service-twitter/pom.xml index 0e6b179..1c5388e 100644 --- a/service-twitter/pom.xml +++ b/service-twitter/pom.xml @@ -5,7 +5,7 @@ at.aic18.g6t4 service-twitter - 0.0.1-SNAPSHOT + 0.1.0-SNAPSHOT jar Twitter Service -- 2.43.0