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
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 @@
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 @@
"**/build/**",
"gradlew",
"gradlew.bat",
- "README.md"
+ "README.md",
+ "**/.dockerignore/**"
]
plainOutput = true
}