forked from aws-samples/aws-lambda-java-custom-runtime
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
27 lines (22 loc) · 963 Bytes
/
Copy pathDockerfile
File metadata and controls
27 lines (22 loc) · 963 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
FROM --platform=linux/arm64/v8 amazonlinux:latest
# Add the Amazon Corretto repository
RUN rpm --import https://yum.corretto.aws/corretto.key
RUN curl -L -o /etc/yum.repos.d/corretto.repo https://yum.corretto.aws/corretto.repo
# Update the packages and install Amazon Corretto 18, Maven and Zip
RUN yum -y update
RUN yum install -y java-18-amazon-corretto-devel maven zip
# Set Java 18 as the default
RUN update-alternatives --set java "/usr/lib/jvm/java-18-amazon-corretto/bin/java"
RUN update-alternatives --set javac "/usr/lib/jvm/java-18-amazon-corretto/bin/javac"
# Copy the software folder to the image and build the function
COPY software software
WORKDIR /software/example-function
RUN mvn clean package
# Package everything together into a custom runtime archive
WORKDIR /
COPY bootstrap bootstrap
RUN chmod 755 bootstrap
RUN cp /software/example-function/target/function.jar function.jar
RUN zip -r runtime.zip \
bootstrap \
function.jar \