This example shows you how to build a Java function by using a Dockerfile.
- Dockerfile - contains the containerized Docker build (based on dockerhub library/gradle images) and image build - this includes the gradle invocation
- The
cacheDeps
task inbuild.gradle
pulls down dependencies into the container gradle cache to speed up docker builds. - The
copyDeps
task inbuild.gradle
copies the functions compile deps. - This uses JDK 11 by default
Ensure you have the Fn server running to host your function:
(1) Start the server
$ fn start
(2) Create an app for the function
$ fn create app gradle-build-app
(3) Deploy the function to your app from the gradle-build
directory.
fn deploy --app gradle-build-app --local
(4) Invoke the function
fn invoke gradle-build-app gradle_build