A sample function that demonstrates usage of Cloud Foundry buildpacks on Knative Serving, using the packs Docker images.
This deploys a functions.Upper.java sample function for riff.
Make sure to perform the steps mentioned in "create a Kubernetes secret for pushing images to DockerHub" and "initialize the namespace" sections.
This sample uses the Buildpack build template in the build-templates repo.
Install the Buildpack build template from that repo:
kubectl apply -f https://raw.githubusercontent.com/knative/build-templates/master/buildpack/buildpack.yaml
Clone this repo (https://github.com/trisberg/buildpack-java-fun.git) and then modify service.yaml
modifying the account in image name for the IMAGE argument
to use your DockerHub id since you can't push images to the springdeveloper
account.
Now you can deploy this to Knative Serving from the directory of this repo using:
kubectl apply -f service.yaml
Once deployed, you will see that it first builds and once the build is complete the service will launch.
The status should show Running
:
riff service list
Access the new service:
riff service invoke buildpack-java-fun -- -w '\n' -H 'Content-Type: text/plain' -d hello
To clean up the sample service:
riff service delete buildpack-java-fun