No description or website provided.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
docker
gradle/wrapper
src/main
.gitignore
.gitmodules
Dockerfile
LICENSE
README.MD
build.gradle
build.sh
buildCpp.sh
gradle.properties
gradlew
gradlew.bat

README.MD

Kotlin Native Serverless

This is a small example illustrating this blog post about doing Serverless functions in Native Kotlin.

This is a followup of the previous version that was running in the JVM.

You need to have OpenWhisk up and running, then you could create the action to OpenWhisk with:

$ wsk action create native-fibonacci --docker jamedina/kotlin-native-fibonacci

To test the new action just run:

$ wsk action invoke --result native-fibonacci --param numbers 5

This will output something like:

{
  "result": [
      1,
      1,
      2,
      3,
      5
  ]
}

If you like to run your acction there is an script to create the docker and upload it to docker hub, you need to modify.

You could use this base image to build your own kotlin native serverless functions, follow this Dockerfile to understand how.

If you want to run the function locally first install kotlin native:

git clone --depth 1 https://github.com/JetBrains/kotlin-native.git /kotlin-native
cd /kotlin-native
./gradlew dependencies:update
./gradlew dist
export PATH="$PATH:/kotlin-native/dist/bin"

Then you could build, from this repository

gradlew build

Then to run the action

./build/konan/bin/Fibonacci.kexe "{ \"numbers\" : 5 }"

This will output something like:

{"result":[1,1,2,3,5]}