diff --git a/manifest.json b/manifest.json index c2f1d31f0b..2549a17750 100644 --- a/manifest.json +++ b/manifest.json @@ -85,6 +85,13 @@ "path": "dotnet7_aot_on_provided_al2", "architectures": ["x86_64", "arm64"] }, + { + "displayName": "dotnet8 aot (prov.al2023)", + "runtime": "provided.al2023", + "handler": "bootstrap", + "path": "dotnet8_aot_on_provided_al2023", + "architectures": ["x86_64", "arm64"] + }, { "displayName": "go1.x", "runtime": "go1.x", diff --git a/s3-uploader/runtimes/dotnet8_aot_on_provided_al2023/Dockerfile b/s3-uploader/runtimes/dotnet8_aot_on_provided_al2023/Dockerfile new file mode 100644 index 0000000000..ba3ef3e3c1 --- /dev/null +++ b/s3-uploader/runtimes/dotnet8_aot_on_provided_al2023/Dockerfile @@ -0,0 +1,14 @@ +ARG ARCH +ARG TAG_SUFFIX + +FROM plantpowerjames/dotnet-8-lambda-build:8.0.100${TAG_SUFFIX} as builder +WORKDIR /tmp +COPY src . +RUN if [ "$ARCH" = "arm64" ]; then RID="linux-arm64"; else RID="linux-x64"; fi \ + && dotnet publish -r ${RID} --output /tmp/code + +RUN zip -j /tmp/code.zip /tmp/code/bootstrap + +FROM scratch +COPY --from=builder /tmp/code.zip / +ENTRYPOINT ["/code.zip"] \ No newline at end of file diff --git a/s3-uploader/runtimes/dotnet8_aot_on_provided_al2023/build.sh b/s3-uploader/runtimes/dotnet8_aot_on_provided_al2023/build.sh new file mode 100755 index 0000000000..fc3f45eaf7 --- /dev/null +++ b/s3-uploader/runtimes/dotnet8_aot_on_provided_al2023/build.sh @@ -0,0 +1,17 @@ +DIR_NAME="./runtimes/$1" +ARCH=$2 + +if [ $2 = "x86_64" ]; then + TAG_SUFFIX="" +elif [ $2 = "arm64" ]; then + TAG_SUFFIX="-arm64" +else + echo "The process architecture $2 is set incorrectly. The value can only be either x86_64 or arm64." + exit 1 +fi + +rm ${DIR_NAME}/code_${ARCH}.zip 2> /dev/null + +docker build ${DIR_NAME} --build-arg ARCH=${ARCH} --build-arg TAG_SUFFIX="${TAG_SUFFIX}" -t maxday/dotnet8-aot_${ARCH} +dockerId=$(docker create maxday/dotnet8-aot_${ARCH}) +docker cp $dockerId:/code.zip ${DIR_NAME}/code_${ARCH}.zip \ No newline at end of file diff --git a/s3-uploader/runtimes/dotnet8_aot_on_provided_al2023/src/Function.cs b/s3-uploader/runtimes/dotnet8_aot_on_provided_al2023/src/Function.cs new file mode 100644 index 0000000000..b8d83404e4 --- /dev/null +++ b/s3-uploader/runtimes/dotnet8_aot_on_provided_al2023/src/Function.cs @@ -0,0 +1,27 @@ +using Amazon.Lambda.RuntimeSupport; +using Amazon.Lambda.Serialization.SystemTextJson; +using System.Text.Json.Serialization; + +namespace LambdaPerf; + +public class Function +{ + private static async Task Main() + { + await LambdaBootstrapBuilder.Create(FunctionHandler, new SourceGeneratorLambdaJsonSerializer()) + .Build() + .RunAsync(); + } + + public static StatusResponse FunctionHandler() + { + return new StatusResponse(statusCode: 200); + } +} + +public record StatusResponse(int statusCode); + +[JsonSerializable(typeof(StatusResponse))] +public partial class LambdaFunctionJsonSerializerContext : JsonSerializerContext +{ +} \ No newline at end of file diff --git a/s3-uploader/runtimes/dotnet8_aot_on_provided_al2023/src/LambdaPerf.csproj b/s3-uploader/runtimes/dotnet8_aot_on_provided_al2023/src/LambdaPerf.csproj new file mode 100644 index 0000000000..b9cda16b9e --- /dev/null +++ b/s3-uploader/runtimes/dotnet8_aot_on_provided_al2023/src/LambdaPerf.csproj @@ -0,0 +1,27 @@ + + + Exe + net8.0 + enable + Lambda + bootstrap + true + true + false + true + true + true + Speed + + + + + + + + + + + + + \ No newline at end of file diff --git a/s3-uploader/runtimes/dotnet8_aot_on_provided_al2023/src/aws-lambda-tools-defaults.json b/s3-uploader/runtimes/dotnet8_aot_on_provided_al2023/src/aws-lambda-tools-defaults.json new file mode 100644 index 0000000000..7658ac6201 --- /dev/null +++ b/s3-uploader/runtimes/dotnet8_aot_on_provided_al2023/src/aws-lambda-tools-defaults.json @@ -0,0 +1,8 @@ +{ + "configuration": "Release", + "function-runtime": "provided.al2023", + "function-memory-size": 256, + "function-timeout": 30, + "function-handler": "bootstrap", + "msbuild-parameters": "--self-contained true" +} \ No newline at end of file diff --git a/s3-uploader/runtimes/dotnet8_aot_on_provided_al2023/src/rd.xml b/s3-uploader/runtimes/dotnet8_aot_on_provided_al2023/src/rd.xml new file mode 100644 index 0000000000..36b81fb6b8 --- /dev/null +++ b/s3-uploader/runtimes/dotnet8_aot_on_provided_al2023/src/rd.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file