Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions Dockerfile.rie
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
FROM public.ecr.aws/lambda/ruby:3.3.2025.08.26.15
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's use public.ecr.aws/lambda/ruby:3.3 as this tag will be overiden every time we will release a new image for 3.3.


# Copy source code and build gem in container
COPY . ${LAMBDA_TASK_ROOT}/
WORKDIR ${LAMBDA_TASK_ROOT}

# Uninstall any existing RIC gem for a clean start
RUN gem uninstall -x aws_lambda_ric || true

# Build and install the RIC gem
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we uninstall the previous gem just to be sure we're starting from a clean state?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right, it's a good practice

RUN gem install bundler && \
bundle install && \
rake build && \
gem install pkg/aws_lambda_ric-*.gem

# Copy handler to task root
COPY test/integration/test-handlers/echo/app.rb ${LAMBDA_TASK_ROOT}/

CMD ["app.App::Handler.process"]
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ test-integ: setup-codebuild-agent
build:
rake build

.PHONY: run-local-ric
run-local-ric:
scripts/run-local-ric.sh

.PHONY: pr
pr: init test-unit test-smoke

Expand All @@ -42,6 +46,7 @@ TARGETS
test-integ Run Integration tests.
test-unit Run Unit Tests.
test-smoke Run Sanity/Smoke tests.
run-local-ric Run local RIC changes with Runtime Interface Emulator.
pr Perform all checks before submitting a Pull Request.

endef
22 changes: 22 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,28 @@ This command invokes the function running in the container image and returns a r

*Alternately, you can also include RIE as a part of your base image. See the AWS documentation on how to [Build RIE into your base image](https://docs.aws.amazon.com/lambda/latest/dg/images-test.html#images-test-alternative).*

### Automated Local Testing

For a simple approach to run your local RIC changes, use the one-command setup:

```shell script
make run-local-ric
```

This command will:
1. Build a Docker image with your local RIC code
2. Compile the gem inside the Linux container (avoiding OS compatibility issues)
3. Start the Lambda Runtime Interface Emulator on port 9000
4. Run a test Lambda function using your RIC

Once running, invoke the function from another terminal:

```shell script
curl -X POST "http://localhost:9000/2015-03-31/functions/function/invocations" -d '{}'
```

Modify the test handler in `test/integration/test-handlers/echo/app.rb` to test different scenarios.

## Development

### Building the package
Expand Down
22 changes: 22 additions & 0 deletions scripts/run-local-ric.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/bash
set -euo pipefail

SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$(dirname "$SCRIPT_DIR")"


IMAGE_TAG="ruby-ric-rie-test"
HANDLER="${1:-app.App::Handler.process}"

echo "Starting RIE test setup for Ruby..."

echo "Building test Docker image..."
docker build -t "$IMAGE_TAG" -f "$PROJECT_ROOT/Dockerfile.rie" "$PROJECT_ROOT"

echo "Starting test container on port 9000..."
echo ""
echo "In another terminal, invoke with:"
echo "curl -s -X POST -H 'Content-Type: application/json' \"http://localhost:9000/2015-03-31/functions/function/invocations\" -d '{\"message\":\"test\"}'"
echo ""

exec docker run -it -p 9000:8080 -e _HANDLER="$HANDLER" "$IMAGE_TAG"
30 changes: 0 additions & 30 deletions test/integration/docker-compose.template.yml

This file was deleted.