@@ -11,6 +11,15 @@ You can include this package in your preferred base image to make that base imag
1111
1212## Requirements
1313The Ruby Runtime Interface Client package currently supports ruby 3.0 and above.
14+
15+ ## Migration from 2.x to 3.x
16+
17+ ** Change** : Version 3.0.0 introduced a change in how the handler is specified:
18+
19+ - ** Version 2.x** : Handler was passed as a command line argument
20+ - ** Version 3.x+** : Handler must be specified via the ` _HANDLER ` environment variable
21+
22+ If you're upgrading from 2.x, update your Dockerfile to use the ` _HANDLER ` environment variable instead of relying on ` CMD ` arguments.
1423
1524## Usage
1625
@@ -39,7 +48,9 @@ Or install it manually as:
3948
4049The next step would be to copy your Lambda function code into the image's working directory.
4150You will need to set the ` ENTRYPOINT ` property of the Docker image to invoke the Runtime Interface Client and
42- then set the ` CMD ` argument to specify the desired handler.
51+ set the ` _HANDLER ` environment variable to specify the desired handler.
52+
53+ ** Important** : The Runtime Interface Client requires the handler to be specified via the ` _HANDLER ` environment variable.
4354
4455Example Dockerfile:
4556``` dockerfile
@@ -57,23 +68,16 @@ RUN gem install bundler
5768# Install the Runtime Interface Client
5869RUN gem install aws_lambda_ric
5970
60- # If you want to install Runtime Interface Client From Source, you can uncomment the following `ADD` and `RUN` layers.
61- # Do not forget to comment/remove the above `RUN gem install aws_lambda_ric` command.
62- # ADD https://github.com/aws/aws-lambda-ruby-runtime-interface-client.git /aws_lambda_ric
63- # RUN cd /aws_lambda_ric && \
64- # make init && \
65- # make build && \
66- # gem install --local /aws_lambda_ric/pkg/aws_lambda_ric-3.0.0.gem && \
67- # rm -rf /aws_lambda_ric
68-
6971# Copy function code
7072RUN mkdir -p ${FUNCTION_DIR}
7173COPY app.rb ${FUNCTION_DIR}
7274
7375WORKDIR ${FUNCTION_DIR}
7476
77+ # Set the handler via environment variable
78+ ENV _HANDLER="app.App::Handler.process"
79+
7580ENTRYPOINT ["/usr/local/bin/aws_lambda_ric" ]
76- CMD ["app.App::Handler.process" ]
7781```
7882
7983Note that the ` ENTRYPOINT ` may differ based on the base image used. You can find the correct path by running an
@@ -119,9 +123,10 @@ mkdir -p ~/.aws-lambda-rie && \
119123
120124``` shell script
121125docker run -d -v ~ /.aws-lambda-rie:/aws-lambda -p 9000:8080 \
126+ -e _HANDLER=" app.App::Handler.process" \
122127 --entrypoint /aws-lambda/aws-lambda-rie \
123128 myfunction:latest \
124- /usr/local/bin/aws_lambda_ric app.App::Handler.process
129+ /usr/local/bin/aws_lambda_ric
125130```
126131
127132This runs the image as a container and starts up an endpoint locally at ` http://localhost:9000/2015-03-31/functions/function/invocations ` .
0 commit comments