Skip to content

Commit

Permalink
Merge pull request #257 from kijuky/feature/update-example
Browse files Browse the repository at this point in the history
  • Loading branch information
jrmsamson authored Mar 20, 2024
2 parents 5d26ea0 + 2c2212c commit 7c4ad8c
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
14.17.1
16
11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,12 @@ A ZIO-based AWS Custom Runtime compatible with GraalVM Native Image.
## Installation

```scala
libraryDependencies += "dev.zio" %% "zio-lambda" % "1.0.3"
libraryDependencies += "dev.zio" %% "zio-json" % "0.6.2"
libraryDependencies += "dev.zio" %% "zio-lambda" % "1.0.4"

// Optional dependencies
libraryDependencies += "dev.zio" %% "zio-lambda-event" % "1.0.3"
libraryDependencies += "dev.zio" %% "zio-lambda-response" % "1.0.3"
libraryDependencies += "dev.zio" %% "zio-lambda-event" % "1.0.4"
libraryDependencies += "dev.zio" %% "zio-lambda-response" % "1.0.4"
```

## Usage
Expand Down Expand Up @@ -52,7 +53,7 @@ Each release will contain a zip file ready to be used as a lambda layer) and you
1. Create an AWS Lambda function and choose the runtime where you provide your own bootstrap on Amazon Linux 2

![create-lambda](https://user-images.githubusercontent.com/14280155/164102664-3686e415-20be-4dd9-8979-ea6098a7a4b9.png)
2. Run `sbt graalvm-native-image:packageBin`, we'll find the binary present under the `graalvm-native-image` folder:
2. Run `sbt GraalVMNativeImage/packageBin`, we'll find the binary present under the `graalvm-native-image` folder:

![binary-located](https://user-images.githubusercontent.com/14280155/164103337-6645dfeb-7fc4-4f7f-9b13-8005b0cddead.png)

Expand Down Expand Up @@ -88,7 +89,7 @@ Following the steps from `Direct deployment of native image binary` to produce y
up the native binary into a Docker image and deploy it like that to AWS Lambda.

```Dockerfile
FROM gcr.io/distroless/base
FROM gcr.io/distroless/base-debian12
COPY lambda-example/target/graalvm-native-image/zio-lambda-example /app/zio-lambda-example
CMD ["/app/zio-lambda-example"]
```
Expand Down
9 changes: 3 additions & 6 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -94,18 +94,15 @@ lazy val zioLambdaExample = module("zio-lambda-example", "lambda-example")
stdSettings("zio-lambda-example"),
assembly / assemblyJarName := "zio-lambda-example.jar",
GraalVMNativeImage / mainClass := Some("zio.lambda.example.SimpleHandler"),
GraalVMNativeImage / containerBuildImage := GraalVMNativeImagePlugin
.generateContainerBuildImage(
"hseeberger/scala-sbt:graalvm-ce-21.3.0-java17_1.6.2_3.1.1"
)
.value,
GraalVMNativeImage / containerBuildImage := Some("ghcr.io/graalvm/native-image-community:21.0.2"),
graalVMNativeImageOptions := Seq(
"--verbose",
"--no-fallback",
"--install-exit-handlers",
"--enable-http",
"--allow-incomplete-classpath",
"--link-at-build-time",
"--report-unsupported-elements-at-runtime",
"-H:+UnlockExperimentalVMOptions",
"-H:+StaticExecutableWithDynamicLibC",
"-H:+RemoveSaturatedTypeFlows"
)
Expand Down
5 changes: 3 additions & 2 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ A ZIO-based AWS Custom Runtime compatible with GraalVM Native Image.
## Installation

```scala
libraryDependencies += "dev.zio" %% "zio-json" % "0.6.2"
libraryDependencies += "dev.zio" %% "zio-lambda" % "@VERSION@"

// Optional dependencies
Expand Down Expand Up @@ -52,7 +53,7 @@ Each release will contain a zip file ready to be used as a lambda layer) and you
1. Create an AWS Lambda function and choose the runtime where you provide your own bootstrap on Amazon Linux 2

![create-lambda](https://user-images.githubusercontent.com/14280155/164102664-3686e415-20be-4dd9-8979-ea6098a7a4b9.png)
2. Run `sbt graalvm-native-image:packageBin`, we'll find the binary present under the `graalvm-native-image` folder:
2. Run `sbt GraalVMNativeImage/packageBin`, we'll find the binary present under the `graalvm-native-image` folder:

![binary-located](https://user-images.githubusercontent.com/14280155/164103337-6645dfeb-7fc4-4f7f-9b13-8005b0cddead.png)

Expand Down Expand Up @@ -88,7 +89,7 @@ Following the steps from `Direct deployment of native image binary` to produce y
up the native binary into a Docker image and deploy it like that to AWS Lambda.

```Dockerfile
FROM gcr.io/distroless/base
FROM gcr.io/distroless/base-debian12
COPY lambda-example/target/graalvm-native-image/zio-lambda-example /app/zio-lambda-example
CMD ["/app/zio-lambda-example"]
```
Expand Down

0 comments on commit 7c4ad8c

Please sign in to comment.