You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@fineract.apache.org by ik...@apache.org on 2019/09/02 00:04:28 UTC

[fineract-cn-notifications] 41/43: FINCN-170 create multi-stage Docker build (#15)

This is an automated email from the ASF dual-hosted git repository.

ikamga pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/fineract-cn-notifications.git

commit abd71866b290eef7dde65fb08f26f8ef1d06780f
Author: aasaru <aa...@gmail.com>
AuthorDate: Tue Aug 20 16:29:25 2019 +0300

    FINCN-170 create multi-stage Docker build (#15)
    
    * FINCN-170 create multi-stage Docker build
    
    * FINCN-170 .dockerignore fix
---
 .dockerignore | 10 ----------
 Dockerfile    | 13 ++++++++++---
 2 files changed, 10 insertions(+), 13 deletions(-)

diff --git a/.dockerignore b/.dockerignore
index 8d88495..a3b6dc5 100644
--- a/.dockerignore
+++ b/.dockerignore
@@ -1,17 +1,7 @@
-api/
-component-test/
-gradle/
-gradlew.bat
 LICENSE
 README.md
-settings.gradle
-build.gradle
 docs/
-gradlew
 HEADER
 NOTICE.txt
-service/
 .git/
-.gradle/
 .gitignore
-shared.gradle
\ No newline at end of file
diff --git a/Dockerfile b/Dockerfile
index fd34bc2..b06ed0e 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -16,7 +16,14 @@
 # specific language governing permissions and limitations
 # under the License.
 #
-FROM openjdk:8-jdk-alpine
+FROM openjdk:8-jdk-alpine AS builder
+RUN mkdir builddir
+COPY . builddir
+WORKDIR builddir
+RUN ./gradlew publishToMavenLocal
+
+
+FROM openjdk:8-jdk-alpine AS runner
 
 ARG notification_port=2031
 
@@ -26,6 +33,6 @@ ENV server.max-http-header-size=16384 \
     system.initialclientid=service-runner
 
 WORKDIR /tmp
-COPY notification-service-boot-0.1.0-BUILD-SNAPSHOT.jar .
+COPY --from=builder /builddir/service/build/libs/service-0.1.0-BUILD-SNAPSHOT.jar ./notification-service-boot.jar
 
-CMD ["java", "-jar", "notification-service-boot-0.1.0-BUILD-SNAPSHOT.jar"]
+CMD ["java", "-jar", "notification-service-boot.jar"]