Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
14 changes: 14 additions & 0 deletions s3-uploader/runtimes/dotnet8_aot_on_provided_al2023/Dockerfile
Original file line number Diff line number Diff line change
@@ -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"]
17 changes: 17 additions & 0 deletions s3-uploader/runtimes/dotnet8_aot_on_provided_al2023/build.sh
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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<LambdaFunctionJsonSerializerContext>())
.Build()
.RunAsync();
}

public static StatusResponse FunctionHandler()
{
return new StatusResponse(statusCode: 200);
}
}

public record StatusResponse(int statusCode);

[JsonSerializable(typeof(StatusResponse))]
public partial class LambdaFunctionJsonSerializerContext : JsonSerializerContext
{
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<AWSProjectType>Lambda</AWSProjectType>
<AssemblyName>bootstrap</AssemblyName>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
<PublishAot>true</PublishAot>
<EventSourceSupport>false</EventSourceSupport>
<UseSystemResourceKeys>true</UseSystemResourceKeys>
<InvariantGlobalization>true</InvariantGlobalization>
<StripSymbols>true</StripSymbols>
<OptimizationPreference>Speed</OptimizationPreference>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Amazon.Lambda.RuntimeSupport" Version="1.10.0" />
<PackageReference Include="Amazon.Lambda.Core" Version="2.2.0" />
<PackageReference Include="Amazon.Lambda.Serialization.SystemTextJson" Version="2.4.0" />
</ItemGroup>

<ItemGroup>
<!--The runtime directives file allows the compiler to know what types and assemblies to not trim out of the final binary, even if they don't appear to be used.-->
<RdXmlFile Include="rd.xml" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -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"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<Directives xmlns="http://schemas.microsoft.com/netfx/2013/01/metadata">
<Application>
<Assembly Name="bootstrap" Dynamic="Required All">
</Assembly>
</Application>
</Directives>