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

Commit b1959b5

Browse files
committed
Java8 runtime added
1 parent 6a6be47 commit b1959b5

23 files changed

+105
-9
lines changed

cloudbuild.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,14 @@ steps:
1919
- name: 'gcr.io/cloud-builders/docker'
2020
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', '.' ]
2121

22+
## Build java8 runtime
23+
- name: 'gcr.io/cloud-builders/docker'
24+
args: [ 'build', '-t', 'gcr.io/$PROJECT_ID/knative-lambda-java8:$REVISION_ID', '-t', 'gcr.io/$PROJECT_ID/knative-lambda-java8:latest', '-f' ,'./java8/Dockerfile', '.' ]
25+
2226
images:
2327
- 'gcr.io/$PROJECT_ID/knative-lambda-python37'
2428
- 'gcr.io/$PROJECT_ID/knative-lambda-python27'
2529
- 'gcr.io/$PROJECT_ID/knative-lambda-node4'
2630
- 'gcr.io/$PROJECT_ID/knative-lambda-node10'
2731
- 'gcr.io/$PROJECT_ID/knative-lambda-ruby25'
32+
- 'gcr.io/$PROJECT_ID/knative-lambda-java8'

java8/Dockerfile

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
FROM openjdk:8-jre-alpine
2+
3+
COPY runtime /var/runtime
4+
5+
RUN apk update && apk add --no-cache libc6-compat curl \
6+
&& API_VERSION=$(curl -sI https://github.com/triggermesh/aws-custom-runtime/releases/latest | grep -i "Location:" | awk -F "/" '{print $NF}' | tr -d "\r") \
7+
&& curl -sL https://github.com/triggermesh/aws-custom-runtime/releases/download/${API_VERSION}/aws-custom-runtime > /var/runtime/mockserver \
8+
&& chmod +x /var/runtime/mockserver
9+
10+
ENV LD_LIBRARY_PATH /lib64:/usr/lib64:/var/runtime:/var/runtime/lib:/var/task:/var/task/lib:/opt/lib
11+
ENV LAMBDA_RUNTIME_DIR /var/runtime
12+
ENV LAMBDA_TASK_ROOT /var/task
13+
ENV INVOKER_COUNT 0
14+
ENV INTERNAL_API_PORT 9001
15+
16+
WORKDIR "/var/task"
17+
18+
ENTRYPOINT ["/usr/bin/java", \
19+
"-XX:MaxHeapSize=2834432k", \
20+
"-XX:MaxMetaspaceSize=163840k", \
21+
"-XX:ReservedCodeCacheSize=81920k", \
22+
"-XX:+UseSerialGC", \
23+
"-Xshare:auto", \
24+
"-XX:-TieredCompilation", \
25+
"-jar", \
26+
"/var/runtime/lib/LambdaJavaRTEntry-1.0.jar"]

java8/runtime.yaml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
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: tekton.dev/v1alpha1
16+
kind: Task
17+
metadata:
18+
name: knative-java8-runtime
19+
spec:
20+
inputs:
21+
params:
22+
- name: IMAGE
23+
description: Where to store resulting image
24+
- name: DIRECTORY
25+
description: The subdirectory of the workspace/repo
26+
default: "."
27+
- name: HANDLER
28+
default: "org.lambci.lambda.ExampleHandler"
29+
resources:
30+
- name: sources
31+
targetPath: /workspace
32+
type: git
33+
steps:
34+
- name: dockerfile
35+
image: gcr.io/kaniko-project/executor:debug-v0.8.0
36+
command:
37+
- /busybox/sh
38+
args:
39+
- -c
40+
- |
41+
cd /workspace/workspace/$(inputs.params.DIRECTORY)
42+
cat <<EOF > Dockerfile
43+
FROM gradle:6.0
44+
WORKDIR /app
45+
COPY . .
46+
RUN gradle build
47+
48+
49+
FROM gcr.io/triggermesh/knative-lambda-java8
50+
COPY --from=0 /app/build/docker /var/task
51+
52+
CMD ["$(inputs.params.HANDLER)"]
53+
EOF
54+
- name: export
55+
image: gcr.io/kaniko-project/executor:debug-v0.8.0
56+
args:
57+
- --context=/workspace/workspace/$(inputs.params.DIRECTORY)
58+
- --dockerfile=Dockerfile
59+
- --destination=$(inputs.params.IMAGE)
60+
# Workaround not to use default config which requires gcloud credentials
61+
# to pull base image from public gcr registry
62+
# https://groups.google.com/d/msg/kaniko-users/r5yoP_Ejm_c/ExoEXksDBAAJ
63+
env:
64+
- name: DOCKER_CONFIG
65+
value: "/"
3.26 KB
Binary file not shown.
127 KB
Binary file not shown.
7.23 KB
Binary file not shown.

java8/runtime/lib/gson-2.3.1.jar

202 KB
Binary file not shown.
45.4 KB
Binary file not shown.
255 KB
Binary file not shown.
1.12 MB
Binary file not shown.

0 commit comments

Comments
 (0)