FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Add ruby2.5 runtime · chrisoverzero/docker-lambda@b55522a · GitHub

Commit b55522a

Browse files
committed
Add ruby2.5 runtime
1 parent 113c2dd commit b55522a

11 files changed

Lines changed: 100 additions & 5 deletions

File tree

‎README.md‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,9 @@ docker run --rm -v "$PWD":/var/task lambci/lambda:python3.6 my_module.my_handler
6363
# Python 3.7 requires the handler be given explicitly
6464
docker run --rm -v "$PWD":/var/task lambci/lambda:python3.7 lambda_function.lambda_handler
6565

66+
# Similarly with Ruby 2.5
67+
docker run --rm -v "$PWD":/var/task lambci/lambda:ruby2.5 lambda_function.lambda_handler
68+
6669
# Test on Go 1.x with a compiled handler named my_handler and a custom event
6770
docker run --rm -v "$PWD":/var/task lambci/lambda:go1.x my_handler '{"some": "event"}'
6871

@@ -208,6 +211,7 @@ Docker tags (follow the Lambda runtime names):
208211
- `python2.7`
209212
- `python3.6`
210213
- `python3.7`
214+
- `ruby2.5`
211215
- `java8`
212216
- `go1.x`
213217
- `dotnetcore2.0`
@@ -219,6 +223,7 @@ Docker tags (follow the Lambda runtime names):
219223
- `build-python2.7`
220224
- `build-python3.6`
221225
- `build-python3.7`
226+
- `build-ruby2.5`
222227
- `build-java8`
223228
- `build-go1.x`
224229
- `build-dotnetcore2.0`

‎base/build-all.sh‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash
22

3-
RUNTIMES="nodejs4.3 nodejs6.10 nodejs8.10 python2.7 python3.6 python3.7 java8 go1.x dotnetcore2.0 dotnetcore2.1 provided"
3+
RUNTIMES="nodejs4.3 nodejs6.10 nodejs8.10 python2.7 python3.6 python3.7 ruby2.5 java8 go1.x dotnetcore2.0 dotnetcore2.1 provided"
44

55
TOP_DIR="${PWD}/.."
66

‎base/diff.sh‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash
22

3-
RUNTIMES="nodejs4.3 nodejs6.10 nodejs8.10 python2.7 python3.6 python3.7 java8 go1.x dotnetcore2.0 dotnetcore2.1 provided"
3+
RUNTIMES="nodejs4.3 nodejs6.10 nodejs8.10 python2.7 python3.6 python3.7 ruby2.5 java8 go1.x dotnetcore2.0 dotnetcore2.1 provided"
44

55
rm -rf diff
66
mkdir -p diff
@@ -60,6 +60,12 @@ diff docker/var/runtime/bootstrap.py lambda/var/runtime/bootstrap.py
6060
diff docker/var/runtime/lambda_runtime_client.py lambda/var/runtime/lambda_runtime_client.py
6161
diff -qr docker lambda | grep -v __pycache__
6262

63+
cd ${DIFF_DIR}/ruby2.5
64+
pwd
65+
diff docker/var/runtime/bootstrap lambda/var/runtime/bootstrap
66+
diff docker/var/runtime/lib lambda/var/runtime/lib
67+
diff -qr docker lambda
68+
6369
cd ${DIFF_DIR}/java8
6470
pwd
6571
diff -qr docker lambda

‎base/dump-ruby25.rb‎

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
require 'json'
2+
require 'aws-sdk-s3'
3+
4+
S3_CLIENT = Aws::S3::Client.new({region: "us-east-1"})
5+
6+
def lambda_handler(event:, context:)
7+
filename = 'ruby2.5.tgz'
8+
9+
puts `tar -cpzf /tmp/#{filename} --numeric-owner --ignore-failed-read /var/runtime /var/lang /var/rapid`
10+
11+
File.open("/tmp/#{filename}", 'rb') do |file|
12+
S3_CLIENT.put_object({
13+
body: file,
14+
bucket: 'lambci',
15+
key: "fs/#{filename}",
16+
acl: 'public-read',
17+
})
18+
end
19+
20+
info = {
21+
'ENV' => ENV.to_hash,
22+
'context' => context.instance_variables.each_with_object({}) { |k, h| h[k] = context.instance_variable_get k },
23+
'ps aux' => `ps aux`,
24+
'proc environ' => `xargs -n 1 -0 < /proc/1/environ`,
25+
}
26+
27+
print JSON.pretty_generate(info)
28+
29+
return info
30+
end
31+

‎base/dump.sh‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash
22

3-
RUNTIMES="node43 node610 node810 python27 python36 python37 java8 go1x dotnetcore20 dotnetcore21 provided"
3+
RUNTIMES="node43 node610 node810 python27 python36 python37 ruby2.5 java8 go1x dotnetcore20 dotnetcore21 provided"
44

55
for RUNTIME in $RUNTIMES; do
66
echo $RUNTIME

‎base/publish-all.sh‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash
22

3-
RUNTIMES="nodejs4.3 nodejs6.10 nodejs8.10 python2.7 python3.6 python3.7 java8 go1.x dotnetcore2.0 dotnetcore2.1 provided"
3+
RUNTIMES="nodejs4.3 nodejs6.10 nodejs8.10 python2.7 python3.6 python3.7 ruby2.5 java8 go1.x dotnetcore2.0 dotnetcore2.1 provided"
44

55
docker push lambci/lambda-base
66

‎base/tag-all.sh‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash
22

3-
RUNTIMES="nodejs4.3 nodejs6.10 nodejs8.10 python2.7 python3.6 python3.7 java8 go1.x dotnetcore2.0 dotnetcore2.1 provided"
3+
RUNTIMES="nodejs4.3 nodejs6.10 nodejs8.10 python2.7 python3.6 python3.7 ruby2.5 java8 go1.x dotnetcore2.0 dotnetcore2.1 provided"
44

55
git tag -f latest
66

‎base/test-all.sh‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ docker run --rm -v "$PWD":/var/task lambci/lambda:python2.7
1919
docker run --rm -v "$PWD":/var/task lambci/lambda:python3.6
2020
docker run --rm -v "$PWD":/var/task lambci/lambda:python3.7 lambda_function.lambda_handler
2121

22+
cd ${EXAMPLES_DIR}/ruby
23+
docker run --rm -v "$PWD":/var/task lambci/lambda:ruby2.5 lambda_function.lambda_handler
24+
2225
cd ${EXAMPLES_DIR}/java
2326
gradle build
2427
docker run --rm -v "$PWD/build/docker":/var/task lambci/lambda:java8 org.lambci.lambda.ExampleHandler '{"some": "event"}'

‎examples/ruby/lambda_function.rb‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
require 'pp'
2+
3+
# docker run --rm -v "$PWD":/var/task lambci/lambda:ruby2.5 lambda_function.lambda_handler
4+
5+
def lambda_handler(event:, context:)
6+
info = {
7+
'event' => event,
8+
'ENV' => ENV.to_hash,
9+
'context' => context.instance_variables.each_with_object({}) { |k, h| h[k] = context.instance_variable_get k },
10+
'ps aux' => `ps aux`,
11+
'proc environ' => `xargs -n 1 -0 < /proc/1/environ`,
12+
}
13+
14+
pp info
15+
16+
return info
17+
end

‎ruby2.5/build/Dockerfile‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
FROM lambci/lambda-base:build
2+
3+
ENV PATH=/var/lang/bin:$PATH \
4+
LD_LIBRARY_PATH=/var/lang/lib:$LD_LIBRARY_PATH \
5+
AWS_EXECUTION_ENV=AWS_Lambda_ruby2.5 \
6+
GEM_HOME=/var/runtime \
7+
GEM_PATH=/var/task/vendor/bundle/ruby/2.5.0:/opt/ruby/gems/2.5.0 \
8+
RUBYLIB=/var/task:/var/runtime/lib:/opt/ruby/lib
9+
10+
RUN rm -rf /var/runtime /var/lang /var/rapid && \
11+
curl https://lambci.s3.amazonaws.com/fs/ruby2.5.tgz | tar -zx -C /
12+
13+
# Add these as a separate layer as they get updated frequently
14+
RUN gem update --system --no-ri --no-rdoc && \
15+
curl --silent --show-error --retry 5 https://bootstrap.pypa.io/get-pip.py | python && \
16+
pip install -U awscli boto3 aws-sam-cli aws-lambda-builders==0.0.3 --no-cache-dir

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL