如何使用自定义 java 17 基础映像将 spring cloud 函数作为 AWS lambda 运行?请提供相同的示例 docker 文件?

问题描述 投票:0回答:0

aws lambda 不支持 Java 17。我需要使用 spring cloud 和 java 17 作为基础映像创建一个 lambda 函数。我必须在我的 Java 17 基础映像中安装哪些依赖项?

这个docker文件我用过

FROM adoptopenjdk:17-jre-hotspot as base
LABEL MAINTAINER=uniphore.com

# configure the build environment


FROM base as build
\#RUN yum install -y maven
WORKDIR /src

# cache and copy dependencies

ADD pom.xml .
RUN mvn dependency:go-offline dependency:copy-dependencies

# compile the function

ADD . .
RUN mvn package

# copy the function artifact and dependencies onto a clean base

FROM base
WORKDIR /function

COPY --from=build /src/target/dependency/*.jar ./
COPY --from=build /src/target/*.jar ./

# configure the runtime startup as main

ENTRYPOINT \[ "/usr/bin/java", "-cp", "./\*", "com.amazonaws.services.lambda.runtime.api.client.AWSLambda" \]

# pass the name of the function handler as an argument to the runtime

CMD \[ "org.springframework.cloud.function.adapter.aws.FunctionInvoker::handleRequest" \]\`
aws-lambda aws-serverless spring-cloud-function
© www.soinside.com 2019 - 2024. All rights reserved.