From 97e9a406f5b2402a7854dbb4e0014d0fe1d2635c Mon Sep 17 00:00:00 2001 From: Maxime David Date: Mon, 20 Apr 2026 11:20:53 +0000 Subject: [PATCH 1/4] fix: documentation --- README.md | 27 +++++---------------------- 1 file changed, 5 insertions(+), 22 deletions(-) diff --git a/README.md b/README.md index d523104..51b54a8 100644 --- a/README.md +++ b/README.md @@ -56,30 +56,13 @@ set the `_HANDLER` environment variable to specify the desired handler. Example Dockerfile: ```dockerfile -FROM amazonlinux:latest +FROM public.ecr.aws/lambda/ruby:3.4 -# Define custom function directory -ARG FUNCTION_DIR="/function" +# Add your handler definition +ADD test/integration/test-handlers/echo/app.rb . -# Install ruby -RUN dnf install -y ruby3.2 make - -# Install bundler -RUN gem install bundler - -# Install the Runtime Interface Client -RUN gem install aws_lambda_ric - -# Copy function code -RUN mkdir -p ${FUNCTION_DIR} -COPY app.rb ${FUNCTION_DIR} - -WORKDIR ${FUNCTION_DIR} - -# Set the handler via environment variable -ENV _HANDLER="app.App::Handler.process" - -ENTRYPOINT ["/usr/local/bin/aws_lambda_ric"] +# Specify your handler +CMD ["app.App::Handler.process"] ``` Note that the `ENTRYPOINT` may differ based on the base image used. You can find the correct path by running an From 17c980765b5222c46eb445d4c4f350de72360c24 Mon Sep 17 00:00:00 2001 From: Maxime David Date: Mon, 20 Apr 2026 11:25:57 +0000 Subject: [PATCH 2/4] fix: base OS --- README.md | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 51b54a8..2a54911 100644 --- a/README.md +++ b/README.md @@ -23,16 +23,21 @@ The Ruby Runtime Interface Client package currently supports ruby 3.0 and above. If you're upgrading from 2.x, update your Dockerfile to use the `_HANDLER` environment variable instead of relying on `CMD` arguments. +## Supported Base Operating Systems + +The Ruby Runtime Interface Client supports the following Linux distributions: + +- **Amazon Linux 2023** +- **Alpine** +- **Debian** +- **Ubuntu** + +For Alpine, Debian, and Ubuntu, we support the latest LTS release and the previous LTS release for 6 months after a new LTS version has been released. + ## Usage ### Creating a Docker Image for Lambda with the Runtime Interface Client -First step is to choose the base image to be used. The supported Linux OS distributions are: - - - Amazon Linux 2023 - - Amazon Linux 2 - - Alpine - - Debian - - Ubuntu +First step is to choose the base image to be used. In order to install the Runtime Interface Client, either add this line to your application's Gemfile: From 533d39bb050ee539c94e852a9bba2513486bb4c2 Mon Sep 17 00:00:00 2001 From: Maxime David Date: Wed, 22 Apr 2026 13:13:23 +0000 Subject: [PATCH 3/4] fix: add sample --- README.md | 63 +++++++++++++--------------------------- sample/Dockerfile.alpine | 39 +++++++++++++++++++++++++ 2 files changed, 59 insertions(+), 43 deletions(-) create mode 100644 sample/Dockerfile.alpine diff --git a/README.md b/README.md index 2a54911..e18dfbe 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,23 @@ The Ruby Runtime Interface Client package currently supports ruby 3.0 and above. If you're upgrading from 2.x, update your Dockerfile to use the `_HANDLER` environment variable instead of relying on `CMD` arguments. -## Supported Base Operating Systems +## Usage + +Create a Ruby handler. This is an example `app.rb`: + +```ruby +module App + class Handler + def self.process(event:, context:) + "Hello World!" + end + end +end +``` + +### Creating a Docker Image for Lambda with the Runtime Interface Client + +#### Supported Base Operating Systems The Ruby Runtime Interface Client supports the following Linux distributions: @@ -33,31 +49,11 @@ The Ruby Runtime Interface Client supports the following Linux distributions: - **Ubuntu** For Alpine, Debian, and Ubuntu, we support the latest LTS release and the previous LTS release for 6 months after a new LTS version has been released. - -## Usage - -### Creating a Docker Image for Lambda with the Runtime Interface Client First step is to choose the base image to be used. -In order to install the Runtime Interface Client, either add this line to your application's Gemfile: - -```ruby -gem 'aws_lambda_ric' -``` - -And then execute: - - $ bundle - -Or install it manually as: +#### Amazon Linux 2023 - $ gem install aws_lambda_ric - -The next step would be to copy your Lambda function code into the image's working directory. -You will need to set the `ENTRYPOINT` property of the Docker image to invoke the Runtime Interface Client and -set the `_HANDLER` environment variable to specify the desired handler. - -**Important**: The Runtime Interface Client requires the handler to be specified via the `_HANDLER` environment variable. +AWS Lambda provides ready to use OCI image based on Amazon Linux 2023, you just need to copy your handler file and specify the `CMD` command. Example Dockerfile: ```dockerfile @@ -70,27 +66,8 @@ ADD test/integration/test-handlers/echo/app.rb . CMD ["app.App::Handler.process"] ``` -Note that the `ENTRYPOINT` may differ based on the base image used. You can find the correct path by running an -interactive shell in the container and checking the installed location of the gem. - -```shell script -docker run -it --rm amazonlinux:latest bash -yum install -y which ruby -gem install aws_lambda_ric -which aws_lambda_ric -``` - -Finally, create a Ruby handler. This is an example `app.rb`: +For other distributions, please refer to Dockerfile in the code sample directory. -```ruby -module App - class Handler - def self.process(event:, context:) - "Hello World!" - end - end -end -``` ### Local Testing diff --git a/sample/Dockerfile.alpine b/sample/Dockerfile.alpine new file mode 100644 index 0000000..b3b20ee --- /dev/null +++ b/sample/Dockerfile.alpine @@ -0,0 +1,39 @@ +# Define global args +ARG RUNTIME_VERSION +ARG DISTRO_VERSION + +# Grab a fresh copy of the image and install ruby and build the runtime interface client gem +FROM ruby:${RUNTIME_VERSION}-alpine${DISTRO_VERSION} AS build-image + +RUN gem install bundler +RUN apk add --no-cache git + +ARG RIC_BUILD_DIR="/build" +# Create directory to build the Runtime Interface Client gem +RUN mkdir -p ${RIC_BUILD_DIR} + +WORKDIR ${RIC_BUILD_DIR} + +COPY . . +RUN rake build + + +# Grab a fresh copy of the Ruby image +FROM ruby:${RUNTIME_VERSION}-alpine${DISTRO_VERSION} + +# Copy the Runtime Interface Client gem and install it +ARG RIC_BUILD_DIR="/build" +COPY --from=build-image ${RIC_BUILD_DIR}/pkg/aws_lambda_ric*.gem aws_lambda_ric.gem +RUN apk add --no-cache curl +RUN gem install aws_lambda_ric.gem + +ARG FUNCTION_DIR="/function" + +RUN mkdir -p ${FUNCTION_DIR} +# Copy function code +COPY test/integration/test-handlers/echo/* ${FUNCTION_DIR} +# Set working directory to function root directory +WORKDIR ${FUNCTION_DIR} + +ENTRYPOINT ["aws_lambda_ric"] +CMD ["app.App::Handler.process"] \ No newline at end of file From 6dc69957c7eab51d550e44fa5ac05094ed5032d4 Mon Sep 17 00:00:00 2001 From: Maxime David Date: Thu, 23 Apr 2026 14:02:15 +0000 Subject: [PATCH 4/4] fix: readme --- .gitignore | 3 ++- .idea/.gitignore | 8 -------- .idea/misc.xml | 4 ---- .idea/modules.xml | 8 -------- .idea/vcs.xml | 6 ------ Dockerfile.rie | 2 +- README.md | 2 +- sample/Dockerfile.alpine | 39 --------------------------------------- 8 files changed, 4 insertions(+), 68 deletions(-) delete mode 100644 .idea/.gitignore delete mode 100644 .idea/misc.xml delete mode 100644 .idea/modules.xml delete mode 100644 .idea/vcs.xml delete mode 100644 sample/Dockerfile.alpine diff --git a/.gitignore b/.gitignore index f29279b..9e94c20 100644 --- a/.gitignore +++ b/.gitignore @@ -17,4 +17,5 @@ Gemfile.lock .test-runner/ .vscode/ -.scratch \ No newline at end of file +.scratch +.idea \ No newline at end of file diff --git a/.idea/.gitignore b/.idea/.gitignore deleted file mode 100644 index 13566b8..0000000 --- a/.idea/.gitignore +++ /dev/null @@ -1,8 +0,0 @@ -# Default ignored files -/shelf/ -/workspace.xml -# Editor-based HTTP Client requests -/httpRequests/ -# Datasource local storage ignored files -/dataSources/ -/dataSources.local.xml diff --git a/.idea/misc.xml b/.idea/misc.xml deleted file mode 100644 index a98e134..0000000 --- a/.idea/misc.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml deleted file mode 100644 index 828d50f..0000000 --- a/.idea/modules.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml deleted file mode 100644 index 35eb1dd..0000000 --- a/.idea/vcs.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/Dockerfile.rie b/Dockerfile.rie index 021150f..671b9b8 100644 --- a/Dockerfile.rie +++ b/Dockerfile.rie @@ -1,4 +1,4 @@ -FROM public.ecr.aws/lambda/ruby:3.3 +FROM public.ecr.aws/lambda/ruby:3.4 # Copy source code and build gem in container COPY . ${LAMBDA_TASK_ROOT}/ diff --git a/README.md b/README.md index e18dfbe..be3c4cb 100644 --- a/README.md +++ b/README.md @@ -66,7 +66,7 @@ ADD test/integration/test-handlers/echo/app.rb . CMD ["app.App::Handler.process"] ``` -For other distributions, please refer to Dockerfile in the code sample directory. +For other distributions, please refer to Dockerfiles in the [test/integration/docker](test/integration/docker) directory. ### Local Testing diff --git a/sample/Dockerfile.alpine b/sample/Dockerfile.alpine deleted file mode 100644 index b3b20ee..0000000 --- a/sample/Dockerfile.alpine +++ /dev/null @@ -1,39 +0,0 @@ -# Define global args -ARG RUNTIME_VERSION -ARG DISTRO_VERSION - -# Grab a fresh copy of the image and install ruby and build the runtime interface client gem -FROM ruby:${RUNTIME_VERSION}-alpine${DISTRO_VERSION} AS build-image - -RUN gem install bundler -RUN apk add --no-cache git - -ARG RIC_BUILD_DIR="/build" -# Create directory to build the Runtime Interface Client gem -RUN mkdir -p ${RIC_BUILD_DIR} - -WORKDIR ${RIC_BUILD_DIR} - -COPY . . -RUN rake build - - -# Grab a fresh copy of the Ruby image -FROM ruby:${RUNTIME_VERSION}-alpine${DISTRO_VERSION} - -# Copy the Runtime Interface Client gem and install it -ARG RIC_BUILD_DIR="/build" -COPY --from=build-image ${RIC_BUILD_DIR}/pkg/aws_lambda_ric*.gem aws_lambda_ric.gem -RUN apk add --no-cache curl -RUN gem install aws_lambda_ric.gem - -ARG FUNCTION_DIR="/function" - -RUN mkdir -p ${FUNCTION_DIR} -# Copy function code -COPY test/integration/test-handlers/echo/* ${FUNCTION_DIR} -# Set working directory to function root directory -WORKDIR ${FUNCTION_DIR} - -ENTRYPOINT ["aws_lambda_ric"] -CMD ["app.App::Handler.process"] \ No newline at end of file