From bc363b72736033a03f3927c517fee1cc56353152 Mon Sep 17 00:00:00 2001 From: Phil Asmar Date: Mon, 16 Mar 2026 17:45:38 -0400 Subject: [PATCH 1/2] Update Lambda Runtime Images for NET 11 --- .gitattributes | 2 + .github/workflows/auto-update-Dockerfiles.yml | 60 +++++++++++---- .../build-lambda-runtime-dockerfiles.yml | 64 ++++++++++++++++ .github/workflows/update-Dockerfiles.yml | 56 +++++++++++--- .../Images/net10/amd64/Dockerfile | 7 +- .../Images/net10/arm64/Dockerfile | 7 +- .../Images/net11/amd64/Dockerfile | 75 +++++++++++++++++++ .../Images/net11/arm64/Dockerfile | 75 +++++++++++++++++++ .../Images/net8/amd64/Dockerfile | 2 +- .../Images/net8/arm64/Dockerfile | 2 +- .../Images/net9/amd64/Dockerfile | 2 +- .../Images/net9/arm64/Dockerfile | 2 +- .../Amazon.Lambda.RuntimeSupport.csproj | 6 +- .../SnapshotRestore.Registry.csproj | 2 +- 14 files changed, 323 insertions(+), 39 deletions(-) create mode 100644 .gitattributes create mode 100644 .github/workflows/build-lambda-runtime-dockerfiles.yml create mode 100644 LambdaRuntimeDockerfiles/Images/net11/amd64/Dockerfile create mode 100644 LambdaRuntimeDockerfiles/Images/net11/arm64/Dockerfile diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 000000000..c6773b5f7 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,2 @@ +*.sh text eol=lf +Dockerfile text eol=lf \ No newline at end of file diff --git a/.github/workflows/auto-update-Dockerfiles.yml b/.github/workflows/auto-update-Dockerfiles.yml index df7492e90..6814af252 100644 --- a/.github/workflows/auto-update-Dockerfiles.yml +++ b/.github/workflows/auto-update-Dockerfiles.yml @@ -10,7 +10,7 @@ on: - cron: '0 0 * * *' # Allows to run this workflow manually from the Actions tab for testing workflow_dispatch: - + jobs: @@ -23,6 +23,8 @@ jobs: NET_9_ARM64_Dockerfile: "LambdaRuntimeDockerfiles/Images/net9/arm64/Dockerfile" NET_10_AMD64_Dockerfile: "LambdaRuntimeDockerfiles/Images/net10/amd64/Dockerfile" NET_10_ARM64_Dockerfile: "LambdaRuntimeDockerfiles/Images/net10/arm64/Dockerfile" + NET_11_AMD64_Dockerfile: "LambdaRuntimeDockerfiles/Images/net11/amd64/Dockerfile" + NET_11_ARM64_Dockerfile: "LambdaRuntimeDockerfiles/Images/net11/arm64/Dockerfile" steps: # Checks-out the repository under $GITHUB_WORKSPACE @@ -114,6 +116,34 @@ jobs: Write-Host "Skipping .NET 10 ARM64 update - No version detected" } + # Update .NET 11 AMD64 Dockerfile + - name: Update .NET 11 AMD64 + id: update-net11-amd64 + shell: pwsh + env: + DOCKERFILE_PATH: ${{ env.NET_11_AMD64_Dockerfile }} + run: | + $version = & "./LambdaRuntimeDockerfiles/get-latest-aspnet-versions.ps1" -MajorVersion "11" + if (-not [string]::IsNullOrEmpty($version)) { + & "./LambdaRuntimeDockerfiles/update-dockerfile.ps1" -DockerfilePath "${{ env.DOCKERFILE_PATH }}" -NextVersion $version + } else { + Write-Host "Skipping .NET 11 AMD64 update - No version detected" + } + + # Update .NET 11 ARM64 Dockerfile + - name: Update .NET 11 ARM64 + id: update-net11-arm64 + shell: pwsh + env: + DOCKERFILE_PATH: ${{ env.NET_11_ARM64_Dockerfile }} + run: | + $version = & "./LambdaRuntimeDockerfiles/get-latest-aspnet-versions.ps1" -MajorVersion "11" + if (-not [string]::IsNullOrEmpty($version)) { + & "./LambdaRuntimeDockerfiles/update-dockerfile.ps1" -DockerfilePath "${{ env.DOCKERFILE_PATH }}" -NextVersion $version + } else { + Write-Host "Skipping .NET 11 ARM64 update - No version detected" + } + # Commit changes and create a branch - name: Commit and Push id: commit-push @@ -159,25 +189,27 @@ jobs: destination_branch: "dev" pr_title: 'chore: Daily ASP.NET Core version update in Dockerfiles' pr_body: "This PR automatically updates the Dockerfiles to use the latest ASP.NET Core version. - + Verify that the Dockerfiles have correct versions and matching SHA512 checksums for ASP.NET Core runtime. - + All .NET versions: https://dotnet.microsoft.com/en-us/download/dotnet - + *Description of changes:* \n${{ format - ( - '{0}\n{1}\n{2}\n{3}\n{4}\n{5}', - join(steps.update-net8-amd64.outputs.MESSAGE, '\n'), - join(steps.update-net8-arm64.outputs.MESSAGE, '\n'), - join(steps.update-net9-amd64.outputs.MESSAGE, '\n'), - join(steps.update-net9-arm64.outputs.MESSAGE, '\n'), - join(steps.update-net10-amd64.outputs.MESSAGE, '\n'), - join(steps.update-net10-arm64.outputs.MESSAGE, '\n') - ) + ( + '{0}\n{1}\n{2}\n{3}\n{4}\n{5}\n{6}\n{7}', + join(steps.update-net8-amd64.outputs.MESSAGE, '\n'), + join(steps.update-net8-arm64.outputs.MESSAGE, '\n'), + join(steps.update-net9-amd64.outputs.MESSAGE, '\n'), + join(steps.update-net9-arm64.outputs.MESSAGE, '\n'), + join(steps.update-net10-amd64.outputs.MESSAGE, '\n'), + join(steps.update-net10-arm64.outputs.MESSAGE, '\n'), + join(steps.update-net11-amd64.outputs.MESSAGE, '\n'), + join(steps.update-net11-arm64.outputs.MESSAGE, '\n') + ) }}" github_token: ${{ secrets.GITHUB_TOKEN }} - + # Add "Release Not Needed" label to the PR - name: Add Release Not Needed label if: ${{ steps.pull-request.outputs.pr_number }} diff --git a/.github/workflows/build-lambda-runtime-dockerfiles.yml b/.github/workflows/build-lambda-runtime-dockerfiles.yml new file mode 100644 index 000000000..3a4d6e101 --- /dev/null +++ b/.github/workflows/build-lambda-runtime-dockerfiles.yml @@ -0,0 +1,64 @@ +name: Build Lambda Runtime Images + +on: + pull_request: + paths: + - "LambdaRuntimeDockerfiles/**" + push: + paths: + - "LambdaRuntimeDockerfiles/**" + +permissions: + contents: read + +jobs: + build-runtime-images: + name: Build runtime image (${{ matrix.name }}) + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + include: + - name: NET 8 AMD64 + dockerfile: LambdaRuntimeDockerfiles/Images/net8/amd64/Dockerfile + platform: linux/amd64 + - name: NET 8 ARM64 + dockerfile: LambdaRuntimeDockerfiles/Images/net8/arm64/Dockerfile + platform: linux/arm64 + - name: NET 9 AMD64 + dockerfile: LambdaRuntimeDockerfiles/Images/net9/amd64/Dockerfile + platform: linux/amd64 + - name: NET 9 ARM64 + dockerfile: LambdaRuntimeDockerfiles/Images/net9/arm64/Dockerfile + platform: linux/arm64 + - name: NET 10 AMD64 + dockerfile: LambdaRuntimeDockerfiles/Images/net10/amd64/Dockerfile + platform: linux/amd64 + - name: NET 10 ARM64 + dockerfile: LambdaRuntimeDockerfiles/Images/net10/arm64/Dockerfile + platform: linux/arm64 + - name: NET 11 AMD64 + dockerfile: LambdaRuntimeDockerfiles/Images/net11/amd64/Dockerfile + platform: linux/amd64 + - name: NET 11 ARM64 + dockerfile: LambdaRuntimeDockerfiles/Images/net11/arm64/Dockerfile + platform: linux/arm64 + + steps: + - uses: actions/checkout@85e6279cec87321a52edac9c87bce653a07cf6c2 #v4.2.2 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Build ${{ matrix.name }} + uses: docker/build-push-action@v6 + with: + context: . + file: ${{ matrix.dockerfile }} + platforms: ${{ matrix.platform }} + push: false + provenance: false + diff --git a/.github/workflows/update-Dockerfiles.yml b/.github/workflows/update-Dockerfiles.yml index d6290d004..cfa754f4f 100644 --- a/.github/workflows/update-Dockerfiles.yml +++ b/.github/workflows/update-Dockerfiles.yml @@ -50,6 +50,20 @@ on: description: ".NET 10 Next Version" type: string required: true + NET_11_AMD64: + description: ".NET 11 AMD64" + type: boolean + required: true + default: true + NET_11_ARM64: + description: ".NET 11 ARM64" + type: boolean + required: true + default: true + NET_11_NEXT_VERSION: + description: ".NET 11 Next Version" + type: string + required: true jobs: build: @@ -61,6 +75,8 @@ jobs: NET_9_ARM64_Dockerfile: "LambdaRuntimeDockerfiles/Images/net9/arm64/Dockerfile" NET_10_AMD64_Dockerfile: "LambdaRuntimeDockerfiles/Images/net10/amd64/Dockerfile" NET_10_ARM64_Dockerfile: "LambdaRuntimeDockerfiles/Images/net10/arm64/Dockerfile" + NET_11_AMD64_Dockerfile: "LambdaRuntimeDockerfiles/Images/net11/amd64/Dockerfile" + NET_11_ARM64_Dockerfile: "LambdaRuntimeDockerfiles/Images/net11/arm64/Dockerfile" # Steps represent a sequence of tasks that will be executed as part of the job steps: @@ -129,6 +145,26 @@ jobs: .\LambdaRuntimeDockerfiles\update-dockerfile.ps1 -DockerfilePath "${{ env.DOCKERFILE_PATH }}" -NextVersion "${{ env.NEXT_VERSION }}" if: ${{ github.event.inputs.NET_10_ARM64 == 'true' }} + - name: Update .NET 11 AMD64 + id: update-net11-amd64 + shell: pwsh + env: + DOCKERFILE_PATH: ${{ env.NET_11_AMD64_Dockerfile }} + NEXT_VERSION: ${{ github.event.inputs.NET_11_NEXT_VERSION }} + run: | + .\LambdaRuntimeDockerfiles\update-dockerfile.ps1 -DockerfilePath "${{ env.DOCKERFILE_PATH }}" -NextVersion "${{ env.NEXT_VERSION }}" + if: ${{ github.event.inputs.NET_11_AMD64 == 'true' }} + + - name: Update .NET 11 ARM64 + id: update-net11-arm64 + shell: pwsh + env: + DOCKERFILE_PATH: ${{ env.NET_11_ARM64_Dockerfile }} + NEXT_VERSION: ${{ github.event.inputs.NET_11_NEXT_VERSION }} + run: | + .\LambdaRuntimeDockerfiles\update-dockerfile.ps1 -DockerfilePath "${{ env.DOCKERFILE_PATH }}" -NextVersion "${{ env.NEXT_VERSION }}" + if: ${{ github.event.inputs.NET_11_ARM64 == 'true' }} + # Update Dockerfiles if newer version of ASP.NET Core is available - name: Commit and Push id: commit-push @@ -158,15 +194,17 @@ jobs: \n\nAll .NET versions https://dotnet.microsoft.com/en-us/download/dotnet \n\n*Description of changes:* \n${{ format - ( - '{0}\n{1}\n{2}\n{3}\n{4}\n{5}', - join(steps.update-net8-amd64.outputs.MESSAGE, '\n'), - join(steps.update-net8-arm64.outputs.MESSAGE, '\n'), - join(steps.update-net9-amd64.outputs.MESSAGE, '\n'), - join(steps.update-net9-arm64.outputs.MESSAGE, '\n'), - join(steps.update-net10-amd64.outputs.MESSAGE, '\n'), - join(steps.update-net10-arm64.outputs.MESSAGE, '\n') - ) + ( + '{0}\n{1}\n{2}\n{3}\n{4}\n{5}\n{6}\n{7}', + join(steps.update-net8-amd64.outputs.MESSAGE, '\n'), + join(steps.update-net8-arm64.outputs.MESSAGE, '\n'), + join(steps.update-net9-amd64.outputs.MESSAGE, '\n'), + join(steps.update-net9-arm64.outputs.MESSAGE, '\n'), + join(steps.update-net10-amd64.outputs.MESSAGE, '\n'), + join(steps.update-net10-arm64.outputs.MESSAGE, '\n'), + join(steps.update-net11-amd64.outputs.MESSAGE, '\n'), + join(steps.update-net11-arm64.outputs.MESSAGE, '\n') + ) }}" github_token: ${{ secrets.GITHUB_TOKEN }} diff --git a/LambdaRuntimeDockerfiles/Images/net10/amd64/Dockerfile b/LambdaRuntimeDockerfiles/Images/net10/amd64/Dockerfile index d1d4d4a0c..a53f77f7a 100644 --- a/LambdaRuntimeDockerfiles/Images/net10/amd64/Dockerfile +++ b/LambdaRuntimeDockerfiles/Images/net10/amd64/Dockerfile @@ -27,21 +27,20 @@ RUN curl -SL --output aspnetcore.tar.gz https://builds.dotnet.microsoft.com/dotn && rm aspnetcore.tar.gz -FROM mcr.microsoft.com/dotnet/sdk:10.0-preview-trixie-slim AS builder +FROM mcr.microsoft.com/dotnet/sdk:10.0-noble AS builder WORKDIR /src COPY ["Libraries/src/Amazon.Lambda.RuntimeSupport", "Repo/Libraries/src/Amazon.Lambda.RuntimeSupport/"] COPY ["Libraries/src/SnapshotRestore.Registry", "Repo/Libraries/src/SnapshotRestore.Registry/"] COPY ["Libraries/src/Amazon.Lambda.Core", "Repo/Libraries/src/Amazon.Lambda.Core/"] COPY ["buildtools/", "Repo/buildtools/"] RUN dotnet restore "Repo/Libraries/src/Amazon.Lambda.RuntimeSupport/Amazon.Lambda.RuntimeSupport.csproj" /p:TargetFrameworks=net10.0 -WORKDIR "Repo/Libraries/src/Amazon.Lambda.RuntimeSupport" +WORKDIR /src/Repo/Libraries/src/Amazon.Lambda.RuntimeSupport RUN dotnet build "Amazon.Lambda.RuntimeSupport.csproj" /p:ExecutableOutputType=true /p:GenerateDocumentationFile=false /p:TargetFrameworks=net10.0 --runtime linux-x64 -c Release -o /app/build FROM builder AS publish RUN dotnet publish "Amazon.Lambda.RuntimeSupport.csproj" /p:ExecutableOutputType=true /p:GenerateDocumentationFile=false /p:TargetFrameworks=net10.0 -f net10.0 --runtime linux-x64 --self-contained false -p:PublishReadyToRun=true -c Release -o /app/publish -RUN apt-get update && apt-get install -y dos2unix -RUN dos2unix /app/publish/bootstrap.sh && \ +RUN sed -i 's/\r$//' /app/publish/bootstrap.sh && \ mv /app/publish/bootstrap.sh /app/publish/bootstrap && \ chmod +x /app/publish/bootstrap RUN touch /app/publish/empty-certificates.crt diff --git a/LambdaRuntimeDockerfiles/Images/net10/arm64/Dockerfile b/LambdaRuntimeDockerfiles/Images/net10/arm64/Dockerfile index c7086ad65..0eae82b0c 100644 --- a/LambdaRuntimeDockerfiles/Images/net10/arm64/Dockerfile +++ b/LambdaRuntimeDockerfiles/Images/net10/arm64/Dockerfile @@ -27,21 +27,20 @@ RUN curl -SL --output aspnetcore.tar.gz https://builds.dotnet.microsoft.com/dotn && rm aspnetcore.tar.gz -FROM mcr.microsoft.com/dotnet/sdk:10.0-preview-trixie-slim AS builder +FROM mcr.microsoft.com/dotnet/sdk:10.0-noble AS builder WORKDIR /src COPY ["Libraries/src/Amazon.Lambda.RuntimeSupport", "Repo/Libraries/src/Amazon.Lambda.RuntimeSupport/"] COPY ["Libraries/src/SnapshotRestore.Registry", "Repo/Libraries/src/SnapshotRestore.Registry/"] COPY ["Libraries/src/Amazon.Lambda.Core", "Repo/Libraries/src/Amazon.Lambda.Core/"] COPY ["buildtools/", "Repo/buildtools/"] RUN dotnet restore "Repo/Libraries/src/Amazon.Lambda.RuntimeSupport/Amazon.Lambda.RuntimeSupport.csproj" /p:TargetFrameworks=net10.0 -WORKDIR "Repo/Libraries/src/Amazon.Lambda.RuntimeSupport" +WORKDIR /src/Repo/Libraries/src/Amazon.Lambda.RuntimeSupport RUN dotnet build "Amazon.Lambda.RuntimeSupport.csproj" /p:ExecutableOutputType=true /p:GenerateDocumentationFile=false /p:TargetFrameworks=net10.0 --runtime linux-arm64 -c Release -o /app/build FROM builder AS publish RUN dotnet publish "Amazon.Lambda.RuntimeSupport.csproj" /p:ExecutableOutputType=true /p:GenerateDocumentationFile=false /p:TargetFrameworks=net10.0 -f net10.0 --runtime linux-arm64 --self-contained false -p:PublishReadyToRun=true -c Release -o /app/publish -RUN apt-get update && apt-get install -y dos2unix -RUN dos2unix /app/publish/bootstrap.sh && \ +RUN sed -i 's/\r$//' /app/publish/bootstrap.sh && \ mv /app/publish/bootstrap.sh /app/publish/bootstrap && \ chmod +x /app/publish/bootstrap RUN touch /app/publish/empty-certificates.crt diff --git a/LambdaRuntimeDockerfiles/Images/net11/amd64/Dockerfile b/LambdaRuntimeDockerfiles/Images/net11/amd64/Dockerfile new file mode 100644 index 000000000..df5a89084 --- /dev/null +++ b/LambdaRuntimeDockerfiles/Images/net11/amd64/Dockerfile @@ -0,0 +1,75 @@ +# Based on Docker image from: https://github.com/dotnet/dotnet-docker/ + +ARG ASPNET_VERSION=11.0.0-preview.2.26159.112 +ARG ASPNET_SHA512=4c02fbb66bc4b7389e0f43c0ea96a3046954eb3c7ad06bf0f8d90997c2e603dd0a3929e2b29b9e8933cc76341fb5e62ebe5bcb83d9a31419bdd1195904ff5af6 + +ARG LAMBDA_RUNTIME_NAME=dotnet11 +ARG AMAZON_LINUX=public.ecr.aws/lambda/provided:al2023 + +FROM $AMAZON_LINUX AS base + +RUN dnf install libicu-67.1-7.amzn2023.0.4.x86_64 --assumeyes + +FROM base AS builder-net11 +ARG ASPNET_VERSION +ARG ASPNET_SHA512 + +WORKDIR /dotnet + +# Install tar and gzip for unarchiving downloaded tar.gz +RUN dnf install tar gzip --assumeyes + +# Install the ASP.NET Core shared framework +RUN curl -SL --output aspnetcore.tar.gz https://builds.dotnet.microsoft.com/dotnet/aspnetcore/Runtime/$ASPNET_VERSION/aspnetcore-runtime-$ASPNET_VERSION-linux-x64.tar.gz \ + && aspnetcore_sha512=$ASPNET_SHA512 \ + && echo "$aspnetcore_sha512 aspnetcore.tar.gz" | sha512sum -c - \ + && tar -ozxf aspnetcore.tar.gz -C /dotnet \ + && rm aspnetcore.tar.gz + + +FROM mcr.microsoft.com/dotnet/sdk:11.0-preview-resolute AS builder +WORKDIR /src +COPY ["Libraries/src/Amazon.Lambda.RuntimeSupport", "Repo/Libraries/src/Amazon.Lambda.RuntimeSupport/"] +COPY ["Libraries/src/SnapshotRestore.Registry", "Repo/Libraries/src/SnapshotRestore.Registry/"] +COPY ["Libraries/src/Amazon.Lambda.Core", "Repo/Libraries/src/Amazon.Lambda.Core/"] +COPY ["buildtools/", "Repo/buildtools/"] +RUN dotnet restore "Repo/Libraries/src/Amazon.Lambda.RuntimeSupport/Amazon.Lambda.RuntimeSupport.csproj" /p:TargetFrameworks=net11.0 +WORKDIR /src/Repo/Libraries/src/Amazon.Lambda.RuntimeSupport +RUN dotnet build "Amazon.Lambda.RuntimeSupport.csproj" /p:ExecutableOutputType=true /p:GenerateDocumentationFile=false /p:TargetFrameworks=net11.0 --runtime linux-x64 -c Release -o /app/build + + +FROM builder AS publish +RUN dotnet publish "Amazon.Lambda.RuntimeSupport.csproj" /p:ExecutableOutputType=true /p:GenerateDocumentationFile=false /p:TargetFrameworks=net11.0 -f net11.0 --runtime linux-x64 --self-contained false -p:PublishReadyToRun=true -c Release -o /app/publish +RUN sed -i 's/\r$//' /app/publish/bootstrap.sh && \ + mv /app/publish/bootstrap.sh /app/publish/bootstrap && \ + chmod +x /app/publish/bootstrap +RUN touch /app/publish/empty-certificates.crt + + +FROM base + +ARG ASPNET_VERSION +ARG LAMBDA_RUNTIME_NAME + +ENV \ + # Export .NET version as environment variable + DOTNET_VERSION=$ASPNET_VERSION \ + # Enable detection of running in a container + DOTNET_RUNNING_IN_CONTAINER=true \ + # Lambda is opinionated about installing tooling under /var + DOTNET_ROOT=/var/lang/bin \ + # Don't display welcome message on first run + DOTNET_NOLOGO=true \ + # Disable Microsoft's telemetry collection + DOTNET_CLI_TELEMETRY_OPTOUT=true + +COPY --from=builder-net11 /dotnet ${DOTNET_ROOT} +COPY --from=publish /app/publish ${LAMBDA_RUNTIME_DIR} + +# Generate runtime-release file +RUN export BUILD_TIMESTAMP=$(printf '%x' $(date +%s)) && \ + export LOGGING_PROTOCOL="LOGGING=amzn-stdout-tlv" && \ + export LAMBDA_RUNTIME_NAME="LAMBDA_RUNTIME_NAME=${LAMBDA_RUNTIME_NAME}" && \ + echo -e "NAME=dotnet\nVERSION=${ASPNET_VERSION}-${BUILD_TIMESTAMP}\n${LOGGING_PROTOCOL}\n${LAMBDA_RUNTIME_NAME}\n" > ${LAMBDA_RUNTIME_DIR}/runtime-release + +# Entrypoint is inherited from public.ecr.aws/lambda/provided diff --git a/LambdaRuntimeDockerfiles/Images/net11/arm64/Dockerfile b/LambdaRuntimeDockerfiles/Images/net11/arm64/Dockerfile new file mode 100644 index 000000000..9f150d25b --- /dev/null +++ b/LambdaRuntimeDockerfiles/Images/net11/arm64/Dockerfile @@ -0,0 +1,75 @@ +# Based on Docker image from: https://github.com/dotnet/dotnet-docker/ + +ARG ASPNET_VERSION=11.0.0-preview.2.26159.112 +ARG ASPNET_SHA512=711914b72530c8b6ba49e5077942893a52bf5508cc082b09ae04f5c72ae4a09dd78699ffcad16dd25a2fe43d586533f897dcdb5c82ab2982ff6b4ad6fdfe5a58 + +ARG LAMBDA_RUNTIME_NAME=dotnet11 +ARG AMAZON_LINUX=public.ecr.aws/lambda/provided:al2023 + +FROM $AMAZON_LINUX AS base + +RUN dnf install libicu-67.1-7.amzn2023.0.4.aarch64 --assumeyes + +FROM base AS builder-net11 +ARG ASPNET_VERSION +ARG ASPNET_SHA512 + +WORKDIR /dotnet + +# Install tar and gzip for unarchiving downloaded tar.gz +RUN dnf install tar gzip --assumeyes + +# Install the ASP.NET Core shared framework +RUN curl -SL --output aspnetcore.tar.gz https://builds.dotnet.microsoft.com/dotnet/aspnetcore/Runtime/$ASPNET_VERSION/aspnetcore-runtime-$ASPNET_VERSION-linux-arm64.tar.gz \ + && aspnetcore_sha512=$ASPNET_SHA512 \ + && echo "$aspnetcore_sha512 aspnetcore.tar.gz" | sha512sum -c - \ + && tar -ozxf aspnetcore.tar.gz -C /dotnet \ + && rm aspnetcore.tar.gz + + +FROM mcr.microsoft.com/dotnet/sdk:11.0-preview-resolute AS builder +WORKDIR /src +COPY ["Libraries/src/Amazon.Lambda.RuntimeSupport", "Repo/Libraries/src/Amazon.Lambda.RuntimeSupport/"] +COPY ["Libraries/src/SnapshotRestore.Registry", "Repo/Libraries/src/SnapshotRestore.Registry/"] +COPY ["Libraries/src/Amazon.Lambda.Core", "Repo/Libraries/src/Amazon.Lambda.Core/"] +COPY ["buildtools/", "Repo/buildtools/"] +RUN dotnet restore "Repo/Libraries/src/Amazon.Lambda.RuntimeSupport/Amazon.Lambda.RuntimeSupport.csproj" /p:TargetFrameworks=net11.0 +WORKDIR /src/Repo/Libraries/src/Amazon.Lambda.RuntimeSupport +RUN dotnet build "Amazon.Lambda.RuntimeSupport.csproj" /p:ExecutableOutputType=true /p:GenerateDocumentationFile=false /p:TargetFrameworks=net11.0 --runtime linux-arm64 -c Release -o /app/build + + +FROM builder AS publish +RUN dotnet publish "Amazon.Lambda.RuntimeSupport.csproj" /p:ExecutableOutputType=true /p:GenerateDocumentationFile=false /p:TargetFrameworks=net11.0 -f net11.0 --runtime linux-arm64 --self-contained false -p:PublishReadyToRun=true -c Release -o /app/publish +RUN sed -i 's/\r$//' /app/publish/bootstrap.sh && \ + mv /app/publish/bootstrap.sh /app/publish/bootstrap && \ + chmod +x /app/publish/bootstrap +RUN touch /app/publish/empty-certificates.crt + + +FROM base + +ARG ASPNET_VERSION +ARG LAMBDA_RUNTIME_NAME + +ENV \ + # Export .NET version as environment variable + DOTNET_VERSION=$ASPNET_VERSION \ + # Enable detection of running in a container + DOTNET_RUNNING_IN_CONTAINER=true \ + # Lambda is opinionated about installing tooling under /var + DOTNET_ROOT=/var/lang/bin \ + # Don't display welcome message on first run + DOTNET_NOLOGO=true \ + # Disable Microsoft's telemetry collection + DOTNET_CLI_TELEMETRY_OPTOUT=true + +COPY --from=builder-net11 /dotnet ${DOTNET_ROOT} +COPY --from=publish /app/publish ${LAMBDA_RUNTIME_DIR} + +# Generate runtime-release file +RUN export BUILD_TIMESTAMP=$(printf '%x' $(date +%s)) && \ + export LOGGING_PROTOCOL="LOGGING=amzn-stdout-tlv" && \ + export LAMBDA_RUNTIME_NAME="LAMBDA_RUNTIME_NAME=${LAMBDA_RUNTIME_NAME}" && \ + echo -e "NAME=dotnet\nVERSION=${ASPNET_VERSION}-${BUILD_TIMESTAMP}\n${LOGGING_PROTOCOL}\n${LAMBDA_RUNTIME_NAME}\n" > ${LAMBDA_RUNTIME_DIR}/runtime-release + +# Entrypoint is inherited from public.ecr.aws/lambda/provided diff --git a/LambdaRuntimeDockerfiles/Images/net8/amd64/Dockerfile b/LambdaRuntimeDockerfiles/Images/net8/amd64/Dockerfile index 277cb42f5..3fa341885 100644 --- a/LambdaRuntimeDockerfiles/Images/net8/amd64/Dockerfile +++ b/LambdaRuntimeDockerfiles/Images/net8/amd64/Dockerfile @@ -35,7 +35,7 @@ COPY ["Libraries/src/Amazon.Lambda.Core", "Repo/Libraries/src/Amazon.Lambda.Core COPY ["Libraries/src/SnapshotRestore.Registry", "Repo/Libraries/src/SnapshotRestore.Registry/"] COPY ["buildtools/", "Repo/buildtools/"] RUN dotnet restore "Repo/Libraries/src/Amazon.Lambda.RuntimeSupport/Amazon.Lambda.RuntimeSupport.csproj" /p:TargetFrameworks=net8.0 -WORKDIR "Repo/Libraries/src/Amazon.Lambda.RuntimeSupport" +WORKDIR /src/Repo/Libraries/src/Amazon.Lambda.RuntimeSupport RUN dotnet build "Amazon.Lambda.RuntimeSupport.csproj" /p:ExecutableOutputType=true /p:GenerateDocumentationFile=false /p:TargetFrameworks=net8.0 --runtime linux-x64 -c Release -o /app/build diff --git a/LambdaRuntimeDockerfiles/Images/net8/arm64/Dockerfile b/LambdaRuntimeDockerfiles/Images/net8/arm64/Dockerfile index 92a918bd1..7180c4277 100644 --- a/LambdaRuntimeDockerfiles/Images/net8/arm64/Dockerfile +++ b/LambdaRuntimeDockerfiles/Images/net8/arm64/Dockerfile @@ -35,7 +35,7 @@ COPY ["Libraries/src/Amazon.Lambda.Core", "Repo/Libraries/src/Amazon.Lambda.Core COPY ["Libraries/src/SnapshotRestore.Registry", "Repo/Libraries/src/SnapshotRestore.Registry/"] COPY ["buildtools/", "Repo/buildtools/"] RUN dotnet restore "Repo/Libraries/src/Amazon.Lambda.RuntimeSupport/Amazon.Lambda.RuntimeSupport.csproj" /p:TargetFrameworks=net8.0 -WORKDIR "Repo/Libraries/src/Amazon.Lambda.RuntimeSupport" +WORKDIR /src/Repo/Libraries/src/Amazon.Lambda.RuntimeSupport RUN dotnet build "Amazon.Lambda.RuntimeSupport.csproj" /p:ExecutableOutputType=true /p:GenerateDocumentationFile=false /p:TargetFrameworks=net8.0 --runtime linux-arm64 -c Release -o /app/build diff --git a/LambdaRuntimeDockerfiles/Images/net9/amd64/Dockerfile b/LambdaRuntimeDockerfiles/Images/net9/amd64/Dockerfile index b9293f7e4..6fcff677b 100644 --- a/LambdaRuntimeDockerfiles/Images/net9/amd64/Dockerfile +++ b/LambdaRuntimeDockerfiles/Images/net9/amd64/Dockerfile @@ -34,7 +34,7 @@ COPY ["Libraries/src/SnapshotRestore.Registry", "Repo/Libraries/src/SnapshotRest COPY ["Libraries/src/Amazon.Lambda.Core", "Repo/Libraries/src/Amazon.Lambda.Core/"] COPY ["buildtools/", "Repo/buildtools/"] RUN dotnet restore "Repo/Libraries/src/Amazon.Lambda.RuntimeSupport/Amazon.Lambda.RuntimeSupport.csproj" /p:TargetFrameworks=net9.0 -WORKDIR "Repo/Libraries/src/Amazon.Lambda.RuntimeSupport" +WORKDIR /src/Repo/Libraries/src/Amazon.Lambda.RuntimeSupport RUN dotnet build "Amazon.Lambda.RuntimeSupport.csproj" /p:ExecutableOutputType=true /p:GenerateDocumentationFile=false /p:TargetFrameworks=net9.0 --runtime linux-x64 -c Release -o /app/build diff --git a/LambdaRuntimeDockerfiles/Images/net9/arm64/Dockerfile b/LambdaRuntimeDockerfiles/Images/net9/arm64/Dockerfile index 29cc7bafc..2294235c1 100644 --- a/LambdaRuntimeDockerfiles/Images/net9/arm64/Dockerfile +++ b/LambdaRuntimeDockerfiles/Images/net9/arm64/Dockerfile @@ -34,7 +34,7 @@ COPY ["Libraries/src/SnapshotRestore.Registry", "Repo/Libraries/src/SnapshotRest COPY ["Libraries/src/Amazon.Lambda.Core", "Repo/Libraries/src/Amazon.Lambda.Core/"] COPY ["buildtools/", "Repo/buildtools/"] RUN dotnet restore "Repo/Libraries/src/Amazon.Lambda.RuntimeSupport/Amazon.Lambda.RuntimeSupport.csproj" /p:TargetFrameworks=net9.0 -WORKDIR "Repo/Libraries/src/Amazon.Lambda.RuntimeSupport" +WORKDIR /src/Repo/Libraries/src/Amazon.Lambda.RuntimeSupport RUN dotnet build "Amazon.Lambda.RuntimeSupport.csproj" /p:ExecutableOutputType=true /p:GenerateDocumentationFile=false /p:TargetFrameworks=net9.0 --runtime linux-arm64 -c Release -o /app/build diff --git a/Libraries/src/Amazon.Lambda.RuntimeSupport/Amazon.Lambda.RuntimeSupport.csproj b/Libraries/src/Amazon.Lambda.RuntimeSupport/Amazon.Lambda.RuntimeSupport.csproj index 77b2a0057..b3bfb0488 100644 --- a/Libraries/src/Amazon.Lambda.RuntimeSupport/Amazon.Lambda.RuntimeSupport.csproj +++ b/Libraries/src/Amazon.Lambda.RuntimeSupport/Amazon.Lambda.RuntimeSupport.csproj @@ -3,7 +3,7 @@ - netstandard2.0;net6.0;net8.0;net9.0;net10.0 + netstandard2.0;net6.0;net8.0;net9.0;net10.0;net11.0 1.14.2 Provides a bootstrap and Lambda Runtime API Client to help you to develop custom .NET Core Lambda Runtimes. Amazon.Lambda.RuntimeSupport @@ -35,7 +35,7 @@ $(DefineConstants);ExecutableOutputType - + true true @@ -55,7 +55,7 @@ - + diff --git a/Libraries/src/SnapshotRestore.Registry/SnapshotRestore.Registry.csproj b/Libraries/src/SnapshotRestore.Registry/SnapshotRestore.Registry.csproj index 0664c1214..0bb3f5886 100644 --- a/Libraries/src/SnapshotRestore.Registry/SnapshotRestore.Registry.csproj +++ b/Libraries/src/SnapshotRestore.Registry/SnapshotRestore.Registry.csproj @@ -3,7 +3,7 @@ - net8.0;net9.0;net10.0 + net8.0;net9.0;net10.0;net11.0 1.0.1 Provides a Restore Hooks library to help you register before snapshot and after restore hooks. SnapshotRestore.Registry From 6b1b865d72b953f1b8592f9a1c6aa884942a9755 Mon Sep 17 00:00:00 2001 From: Phil Asmar Date: Tue, 17 Mar 2026 12:50:08 -0400 Subject: [PATCH 2/2] add net11 to buildspec --- buildtools/ci.buildspec.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/buildtools/ci.buildspec.yml b/buildtools/ci.buildspec.yml index b4d165456..87cfc5ea3 100644 --- a/buildtools/ci.buildspec.yml +++ b/buildtools/ci.buildspec.yml @@ -11,8 +11,10 @@ phases: - curl -sSL https://dot.net/v1/dotnet-install.sh | bash /dev/stdin --channel 3.1 - curl -sSL https://dot.net/v1/dotnet-install.sh | bash /dev/stdin --channel 9.0 - curl -sSL https://dot.net/v1/dotnet-install.sh | bash /dev/stdin --channel 10.0 + - curl -sSL https://dot.net/v1/dotnet-install.sh | bash /dev/stdin --channel 11.0 build: commands: - dotnet msbuild buildtools/build.proj /t:testtoolv2-tests /p:Cicd=true - - dotnet msbuild buildtools/build.proj /t:unit-tests /p:Cicd=true - - dotnet msbuild buildtools/build.proj /t:integ-tests /p:Cicd=true \ No newline at end of file + - dotnet msbuild buildtools/build.proj /t:unit-tests /p:Cicd=true + - dotnet msbuild buildtools/build.proj /t:integ-tests /p:Cicd=true +