Skip to content

Commit

Permalink
Fix java8 template to support resources
Browse files Browse the repository at this point in the history
With this change all resources within function's
`src/main/resources` will be added to function.jar. Before that
they used to be omited. The distribution, created after `gradle
build` was modifying the jars, excluding all resoursed. Fixed
that by deleting this distribution and creating a controlled one
with `gradle distZip`

Signed-off-by: Ivana Yovcheva (VMware) <[email protected]>
  • Loading branch information
ivanayov committed Oct 2, 2018
1 parent 6b7a4a5 commit c98eb6d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
4 changes: 4 additions & 0 deletions template/java8/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ COPY . /home/app/

RUN gradle build

RUN rm /home/app/entrypoint/build/distributions/entrypoint*

RUN gradle distZip

FROM openjdk:8u121-jdk-alpine as ship
RUN apk --no-cache add curl \
&& echo "Pulling watchdog binary from Github." \
Expand Down
11 changes: 11 additions & 0 deletions template/java8/entrypoint/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -29,6 +32,14 @@ dependencies {
compile project(':function')
}

sourceSets {
main {
resources {
srcDirs "src/main/resources"
}
}
}

jar {
manifest {
attributes 'Implementation-Title': 'OpenFaaS Function',
Expand Down

0 comments on commit c98eb6d

Please sign in to comment.