Skip to content
This repository was archived by the owner on Dec 11, 2023. It is now read-only.

Commit 5af2a58

Browse files
authored
Merge pull request #19 from triggermesh/ruby25
Ruby25
2 parents 53ad6f6 + f5fd9bc commit 5af2a58

File tree

3 files changed

+75
-0
lines changed

3 files changed

+75
-0
lines changed

cloudbuild.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,13 @@ steps:
1515
- name: 'gcr.io/cloud-builders/docker'
1616
args: [ 'build', '-t', 'gcr.io/$PROJECT_ID/knative-lambda-node10:$REVISION_ID', '-t', 'gcr.io/$PROJECT_ID/knative-lambda-node10:latest', '-f' ,'./node-10.x/Dockerfile', '.' ]
1717

18+
## Build ruby25 runtime
19+
- name: 'gcr.io/cloud-builders/docker'
20+
args: [ 'build', '-t', 'gcr.io/$PROJECT_ID/knative-lambda-ruby25:$REVISION_ID', '-t', 'gcr.io/$PROJECT_ID/knative-lambda-ruby25:latest', '-f' ,'./ruby-2.5/Dockerfile', '.' ]
21+
1822
images:
1923
- 'gcr.io/$PROJECT_ID/knative-lambda-python37'
2024
- 'gcr.io/$PROJECT_ID/knative-lambda-python27'
2125
- 'gcr.io/$PROJECT_ID/knative-lambda-node4'
2226
- 'gcr.io/$PROJECT_ID/knative-lambda-node10'
27+
- 'gcr.io/$PROJECT_ID/knative-lambda-ruby25'

ruby-2.5/Dockerfile

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
FROM lambci/lambda:ruby2.5
2+
FROM ruby:2.5-alpine
3+
4+
RUN apk --no-cache add curl \
5+
&& API_VERSION=$(curl -sI https://github.com/triggermesh/aws-custom-runtime/releases/latest | grep "Location:" | awk -F "/" '{print $NF}' | tr -d "\r") \
6+
&& curl -sL https://github.com/triggermesh/aws-custom-runtime/releases/download/${API_VERSION}/aws-custom-runtime > aws-custom-runtime \
7+
&& chmod +x aws-custom-runtime \
8+
9+
ENV RUBYLIB "/opt"
10+
ENV LAMBDA_TASK_ROOT "/opt"
11+
12+
COPY --from=0 /var/runtime/lib /opt
13+
RUN mv /opt/runtime.rb /opt/bootstrap
14+
RUN sed -i /opt/lambda_server.rb -e 's|http://127.0.0.1:9001/2018-06-01|http://127.0.0.1/2018-06-01|'

ruby-2.5/buildtemplate.yaml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# Copyright 2019 TriggerMesh, Inc
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
apiVersion: build.knative.dev/v1alpha1
16+
kind: BuildTemplate
17+
metadata:
18+
name: knative-ruby25-runtime
19+
spec:
20+
parameters:
21+
- name: BASEIMAGE_REGISTRY
22+
default: gcr.io
23+
- name: BASEIMAGE_TAG
24+
default: latest
25+
- name: IMAGE
26+
description: The URI of the image to push, including registry host
27+
- name: TAG
28+
description: Tag of the image being pushed
29+
default: latest
30+
- name: DIRECTORY
31+
description: The subdirectory of the workspace/repo
32+
default: ""
33+
- name: HANDLER
34+
default: "function.handler"
35+
steps:
36+
- name: dockerfile
37+
image: gcr.io/kaniko-project/executor@sha256:30ba460a034a8051b3222a32e20cb6049741e58384e3adf8c8987c004e2f2ab9
38+
command:
39+
- /busybox/sh
40+
args:
41+
- -c
42+
- |
43+
cd /workspace/${DIRECTORY}
44+
cat <<EOF > Dockerfile
45+
FROM ${BASEIMAGE_REGISTRY}/triggermesh/knative-lambda-runtime-ruby25:${BASEIMAGE_TAG}
46+
ENV _HANDLER "${HANDLER}"
47+
48+
COPY . .
49+
ENTRYPOINT ["/opt/aws-custom-runtime"]
50+
EOF
51+
- name: export
52+
image: gcr.io/kaniko-project/executor@sha256:30ba460a034a8051b3222a32e20cb6049741e58384e3adf8c8987c004e2f2ab9
53+
args:
54+
- --context=/workspace/${DIRECTORY}
55+
- --dockerfile=/workspace/${DIRECTORY}/Dockerfile
56+
- --destination=${IMAGE}:${TAG}

0 commit comments

Comments
 (0)