11#! /bin/bash
22set -euo pipefail
33
4+ EXAMPLE=${1:- basic-lambda}
45# Optional: set RIE_MAX_CONCURRENCY to enable LMI mode (emulates AWS_LAMBDA_MAX_CONCURRENCY)
56RIE_MAX_CONCURRENCY=${RIE_MAX_CONCURRENCY:- }
6- # Optional: specify which handler to run (defaults to first handler)
7- HANDLER=${HANDLER:- basic-lambda}
87
9- echo " Building Docker image with RIE (handlers : $HANDLER ) "
10- docker build -f Dockerfile.rie --build-arg HANDLERS_TO_BUILD= " $HANDLER " -t rust-lambda-rie-test .
8+ echo " Building Docker image with RIE for example : $EXAMPLE ... "
9+ docker build -f Dockerfile.rie --build-arg EXAMPLE= $EXAMPLE -t rust-lambda-rie-test .
1110
12- echo " Starting RIE container on port 9000 with handler: $HANDLER "
11+ echo " Starting RIE container on port 9000... "
1312if [ -n " $RIE_MAX_CONCURRENCY " ]; then
1413 echo " Enabling LMI mode with AWS_LAMBDA_MAX_CONCURRENCY=$RIE_MAX_CONCURRENCY "
15- docker run -p 9000:8080 -e AWS_LAMBDA_MAX_CONCURRENCY=" $RIE_MAX_CONCURRENCY " rust-lambda-rie-test " $HANDLER " &
14+ docker run -p 9000:8080 -e AWS_LAMBDA_MAX_CONCURRENCY=" $RIE_MAX_CONCURRENCY " rust-lambda-rie-test &
1615else
17- docker run -p 9000:8080 rust-lambda-rie-test " $HANDLER " &
16+ docker run -p 9000:8080 rust-lambda-rie-test &
1817fi
1918CONTAINER_PID=$!
2019
2120echo " Container started. Test with:"
22- echo " curl -XPOST 'http://localhost:9000/2015-03-31/functions/function/invocations' -d '{\" command\" : \" test from RIE\" }' -H 'Content-Type: application/json'"
23- echo " or for a specific example check under examples/ for the expected payload format."
24-
21+ if [ " $EXAMPLE " = " basic-lambda" ] || [ " $EXAMPLE " = " basic-lambda-concurrent" ]; then
22+ echo " curl -XPOST 'http://localhost:9000/2015-03-31/functions/function/invocations' -d '{\" command\" : \" test from RIE\" }' -H 'Content-Type: application/json'"
23+ else
24+ echo " For example '$EXAMPLE ', check examples/$EXAMPLE /src/main.rs for the expected payload format."
25+ fi
2526echo " "
2627echo " Press Ctrl+C to stop the container."
2728
28- wait $CONTAINER_PID
29+ wait $CONTAINER_PID
0 commit comments