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 e7b98bb..ffc8e4e 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 provisioner_port=2020 @@ -25,6 +32,7 @@ ENV server.max-http-header-size=16384 \ server.port=$provisioner_port WORKDIR /tmp -COPY provisioner-service-boot-0.1.0-BUILD-SNAPSHOT.jar . -CMD ["java", "-jar", "provisioner-service-boot-0.1.0-BUILD-SNAPSHOT.jar"] \ No newline at end of file +COPY --from=builder /builddir/service/build/libs/service-0.1.0-BUILD-SNAPSHOT-boot.jar ./provisioner-service-boot.jar + +CMD ["java", "-jar", "provisioner-service-boot.jar"]