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-portfolio.git


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

commit 96b775f89671642a8b4422cd7c879ac38e6017ce
Author: aasaru <[email protected]>
AuthorDate: Tue Aug 20 16:38:07 2019 +0300

    FINCN-170 create multi-stage Docker build (#17)
    
    * FINCN-170 create multi-stage Docker build
    
    * FINCN-170 fix jar path
---
 .dockerignore | 10 ----------
 Dockerfile    | 12 +++++++++---
 2 files changed, 9 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 0b37c03..3ee37c8 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -16,7 +16,13 @@
 # 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 portfolio_port=2026
 
@@ -26,6 +32,6 @@ ENV server.max-http-header-size=16384 \
     server.port=$portfolio_port
 
 WORKDIR /tmp
-COPY portfolio-service-boot-0.1.0-BUILD-SNAPSHOT.jar .
+COPY --from=builder 
/builddir/service/build/libs/service-0.1.0-BUILD-SNAPSHOT-boot.jar 
./portfolio-service-boot.jar
 
-CMD ["java", "-jar", "portfolio-service-boot-0.1.0-BUILD-SNAPSHOT.jar"]
+CMD ["java", "-jar", "portfolio-service-boot.jar"]

Reply via email to