Java function with Oracle GraalVM 22.3.2 Native Image JDK 17
Generated using Shaun Smith's GraalVM Native Image-based function init-images.
Oracle GraalVM container images are stored in https://container-registry.oracle.com
. You will need an Oracle account (doesn't require a credit card!) to accept the Oracle GraalVM license on container-registry.oracle.com >> GraalVM >> native-image-ee
.
-
Go to
GraalVM >> native-image-ee
. -
Click
Sign in
. -
You will see the Oracle Login screen. If you have an account, enter your user and password to login. If you don't have an account scroll down to the
Create a new Account
section and create you free account (no credit card required). -
Once you've signed in, view and accept the license.
-
From a terminal like OCI Cloud Shell (or on local), login to Oracle Container Registry (OCR). Oracle GraalVM container images are pulled from OCR.
docker login container-registry.oracle.com -u <YOUR_ORACLE_ACCOUNT_USER_NAME>
When prompted, enter your password and hit enter.
-
From the same terminal window, login to OCI Container Registry (OCIR). Your function image will be pushed to your OCIR repo.
docker login -u '<tenancy-namespace>/<your-OCI-user-name>' <region-key>.ocir.io
When prompted for a password, enter your OCI auth token and hit enter.
-
Once you've logged in to both OCR and OCIR, run
fn deploy
.fn -v deploy --app <app-name>
This will use a multistage docker build as per the steps in the Dockerfile to generate an ahead-of-time compiled native executable for the function and deploy it to OCI.
-
(Optional) From the OCI console, go to the function application and enable function logs and traces. Go to the function and enable traces.
-
Invoke the function and check the time it takes to run.
fn invoke <app-name> fngvm2232jdk17
-
(Optional) From the OCI console, check the function's logs and traces and see the time it took to run.