forked from micronaut-projects/micronaut-starter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
DockerfileLambda
37 lines (30 loc) · 1.39 KB
/
DockerfileLambda
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
28
29
30
31
32
33
34
35
36
37
FROM gradle:6.3.0-jdk8 as builder
COPY --chown=gradle:gradle . /home/application
WORKDIR /home/application
RUN gradle clean starter-aws-lambda:shadowJar --no-daemon
RUN pwd
RUN ls -l starter-aws-lambda/build/libs
FROM amazonlinux:2018.03.0.20191219.0 as graalvm
# install graal to amazon linux.
ENV LANG=en_US.UTF-8
RUN yum install -y gcc gcc-c++ libc6-dev zlib1g-dev curl bash zlib zlib-devel zip \
# && yum install -y libcxx libcxx-devel llvm-toolset-7 \
&& rm -rf /var/cache/yum
ENV GRAAL_VERSION 21.0.0.2
ENV JDK_VERSION java8
ENV GRAAL_FILENAME graalvm-ce-${JDK_VERSION}-linux-amd64-${GRAAL_VERSION}.tar.gz
RUN curl -4 -L https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-${GRAAL_VERSION}/${GRAAL_FILENAME} -o /tmp/${GRAAL_FILENAME}
RUN tar -zxvf /tmp/${GRAAL_FILENAME} -C /tmp && mv /tmp/graalvm-ce-${JDK_VERSION}-${GRAAL_VERSION} /usr/lib/graalvm
RUN rm -rf /tmp/*
CMD ["/usr/lib/graalvm/bin/native-image"]
FROM graalvm
WORKDIR /home/application
COPY --from=builder /home/application/starter-aws-lambda/build/libs/starter-aws-lambda-*-all.jar server.jar
COPY --from=builder /home/application/bootstrap bootstrap
RUN /usr/lib/graalvm/bin/gu install native-image
RUN /usr/lib/graalvm/bin/native-image --no-fallback -cp /home/application/server.jar
RUN chmod 755 bootstrap
RUN chmod 755 server
RUN zip -j function.zip bootstrap server
EXPOSE 8080
ENTRYPOINT ["/home/application/server"]