diff --git a/template/java8/Dockerfile b/template/java8/Dockerfile index c994a52a..18db2826 100644 --- a/template/java8/Dockerfile +++ b/template/java8/Dockerfile @@ -20,7 +20,11 @@ WORKDIR /home/app COPY . /home/app/ -RUN gradle build +# The distribution created by `gradle build` is modifying the jars, excluding all resources. +# For that reason it is removed and created with `gradle distZip` +RUN gradle build \ + && rm /home/app/entrypoint/build/distributions/entrypoint* \ + && gradle distZip FROM openjdk:8u121-jdk-alpine as ship RUN apk --no-cache add curl \ diff --git a/template/java8/entrypoint/build.gradle b/template/java8/entrypoint/build.gradle index d059c573..e9ec4e84 100644 --- a/template/java8/entrypoint/build.gradle +++ b/template/java8/entrypoint/build.gradle @@ -13,6 +13,9 @@ plugins { // Apply the application plugin to add support for building an application id 'application' + // Apply the distribution plugin to add resources to entrypoint dist + id 'distribution' + } // Define the main class for the application @@ -29,6 +32,14 @@ dependencies { compile project(':function') } +sourceSets { + main { + resources { + srcDirs "src/main/resources" + } + } +} + jar { manifest { attributes 'Implementation-Title': 'OpenFaaS Function',