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

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


The following commit(s) were added to refs/heads/develop by this push:
     new ddd1c97  FINCN-170 create multi-stage Docker build (#11)
ddd1c97 is described below

commit ddd1c97026020590b7129a5c130c3723d64862ad
Author: aasaru <[email protected]>
AuthorDate: Tue Aug 20 16:02:58 2019 +0300

    FINCN-170 create multi-stage Docker build (#11)
    
    * FINCN-170 create multi-stage Docker build
    
    * FINCN-170 update rat
    
    * FINCN-170 fix boot jar path
---
 .dockerignore | 11 -----------
 Dockerfile    | 13 ++++++++++---
 shared.gradle |  3 ++-
 3 files changed, 12 insertions(+), 15 deletions(-)

diff --git a/.dockerignore b/.dockerignore
index c41cb7f..a3b6dc5 100644
--- a/.dockerignore
+++ b/.dockerignore
@@ -1,18 +1,7 @@
-api/
-component-test/
-gradle/
-gradlew.bat
 LICENSE
 README.md
-settings.gradle
-build.gradle
 docs/
-gradlew
 HEADER
 NOTICE.txt
-service/
-spi/
 .git/
-.gradle/
 .gitignore
-shared.gradle
\ No newline at end of file
diff --git a/Dockerfile b/Dockerfile
index 4313c65..af26daa 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 rhythm_port=2022
 
@@ -27,6 +34,6 @@ ENV server.max-http-header-size=16384 \
     server.port=$rhythm_port
 
 WORKDIR /tmp
-COPY rhythm-service-boot-0.1.0-BUILD-SNAPSHOT.jar .
+COPY --from=builder 
/builddir/service/build/libs/service-0.1.0-BUILD-SNAPSHOT-boot.jar 
./rhythm-service-boot.jar
 
-CMD ["java", "-jar", "rhythm-service-boot-0.1.0-BUILD-SNAPSHOT.jar"]
+CMD ["java", "-jar", "rhythm-service-boot.jar"]
diff --git a/shared.gradle b/shared.gradle
index 2583a97..572a4ed 100644
--- a/shared.gradle
+++ b/shared.gradle
@@ -113,7 +113,8 @@ rat {
             "**/build/**",
             "gradlew",
             "gradlew.bat",
-            "README.md"
+            "README.md",
+            "**/.dockerignore/**"
     ]
     plainOutput = true
 }

Reply via email to