Skip to content

Commit d5356e3

Browse files
committed
feat(serialization): Update documentation and makefile
1 parent e57dae0 commit d5356e3

File tree

2 files changed

+36
-2
lines changed

2 files changed

+36
-2
lines changed

examples/powertools-examples-serialization/sam-graalvm/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
build-APIGatewayDeserializationFunction:
2-
#mvn clean package -P native-image
2+
mvn clean package -P native-image
33
chmod +x target/hello-world
44
cp target/hello-world $(ARTIFACTS_DIR) # (ARTIFACTS_DIR --> https://github.com/aws/aws-lambda-builders/blob/develop/aws_lambda_builders/workflows/custom_make/DESIGN.md#implementation)
55
chmod +x src/main/config/bootstrap
66
cp src/main/config/bootstrap $(ARTIFACTS_DIR)
77

88
build-SQSEventDeserializationFunction:
9-
#mvn clean package -P native-image
9+
mvn clean package -P native-image
1010
chmod +x target/hello-world
1111
cp target/hello-world $(ARTIFACTS_DIR) # (ARTIFACTS_DIR --> https://github.com/aws/aws-lambda-builders/blob/develop/aws_lambda_builders/workflows/custom_make/DESIGN.md#implementation)
1212
chmod +x src/main/config/bootstrap

examples/powertools-examples-serialization/sam-graalvm/README.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,40 @@ in JSON looks like this:
2323
This sample is based on Serverless Application Model (SAM). To deploy it, check out the instructions for getting
2424
started with SAM in [the examples directory](../../README.md)
2525

26+
## Configuration
27+
28+
- Set the environment to use GraalVM
29+
30+
```shell
31+
export JAVA_HOME=<path to GraalVM>
32+
```
33+
34+
## Build the sample application
35+
36+
- Build the Docker image that will be used as the environment for SAM build:
37+
38+
```shell
39+
docker build --platform linux/amd64 . -t powertools-examples-serialization-sam-graalvm
40+
```
41+
42+
- Build the SAM project using the docker image
43+
44+
```shell
45+
sam build --use-container --build-image powertools-examples-serialization-sam-graalvm
46+
```
47+
48+
#### [Optional] Building with -SNAPSHOT versions of PowerTools
49+
50+
- If you are testing the example with a -SNAPSHOT version of PowerTools, the maven build inside the docker image will fail. This is because the -SNAPSHOT version of the PowerTools library that you are working on is still not available in maven central/snapshot repository.
51+
To get around this, follow these steps:
52+
- Create the native image using the `docker` command below on your development machine. The native image is created in the `target` directory.
53+
- `` docker run --platform linux/amd64 -it -v `pwd`:`pwd` -w `pwd` -v ~/.m2:/root/.m2 powertools-examples-serialization-sam-graalvm mvn clean -Pnative-image package -DskipTests ``
54+
- Edit the [`Makefile`](Makefile) remove this line
55+
- `mvn clean package -P native-image`
56+
- Build the SAM project using the docker image
57+
- `sam build --use-container --build-image powertools-examples-serialization-sam-graalvm`
58+
59+
2660
## Test the application
2761

2862
### 1. API Gateway Endpoint

0 commit comments

Comments
 (0)