Skip to content

Commit bc363b7

Browse files
committed
Update Lambda Runtime Images for NET 11
1 parent 0838ea4 commit bc363b7

File tree

14 files changed

+323
-39
lines changed

14 files changed

+323
-39
lines changed

.gitattributes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
*.sh text eol=lf
2+
Dockerfile text eol=lf

.github/workflows/auto-update-Dockerfiles.yml

Lines changed: 46 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ on:
1010
- cron: '0 0 * * *'
1111
# Allows to run this workflow manually from the Actions tab for testing
1212
workflow_dispatch:
13-
13+
1414

1515

1616
jobs:
@@ -23,6 +23,8 @@ jobs:
2323
NET_9_ARM64_Dockerfile: "LambdaRuntimeDockerfiles/Images/net9/arm64/Dockerfile"
2424
NET_10_AMD64_Dockerfile: "LambdaRuntimeDockerfiles/Images/net10/amd64/Dockerfile"
2525
NET_10_ARM64_Dockerfile: "LambdaRuntimeDockerfiles/Images/net10/arm64/Dockerfile"
26+
NET_11_AMD64_Dockerfile: "LambdaRuntimeDockerfiles/Images/net11/amd64/Dockerfile"
27+
NET_11_ARM64_Dockerfile: "LambdaRuntimeDockerfiles/Images/net11/arm64/Dockerfile"
2628

2729
steps:
2830
# Checks-out the repository under $GITHUB_WORKSPACE
@@ -114,6 +116,34 @@ jobs:
114116
Write-Host "Skipping .NET 10 ARM64 update - No version detected"
115117
}
116118
119+
# Update .NET 11 AMD64 Dockerfile
120+
- name: Update .NET 11 AMD64
121+
id: update-net11-amd64
122+
shell: pwsh
123+
env:
124+
DOCKERFILE_PATH: ${{ env.NET_11_AMD64_Dockerfile }}
125+
run: |
126+
$version = & "./LambdaRuntimeDockerfiles/get-latest-aspnet-versions.ps1" -MajorVersion "11"
127+
if (-not [string]::IsNullOrEmpty($version)) {
128+
& "./LambdaRuntimeDockerfiles/update-dockerfile.ps1" -DockerfilePath "${{ env.DOCKERFILE_PATH }}" -NextVersion $version
129+
} else {
130+
Write-Host "Skipping .NET 11 AMD64 update - No version detected"
131+
}
132+
133+
# Update .NET 11 ARM64 Dockerfile
134+
- name: Update .NET 11 ARM64
135+
id: update-net11-arm64
136+
shell: pwsh
137+
env:
138+
DOCKERFILE_PATH: ${{ env.NET_11_ARM64_Dockerfile }}
139+
run: |
140+
$version = & "./LambdaRuntimeDockerfiles/get-latest-aspnet-versions.ps1" -MajorVersion "11"
141+
if (-not [string]::IsNullOrEmpty($version)) {
142+
& "./LambdaRuntimeDockerfiles/update-dockerfile.ps1" -DockerfilePath "${{ env.DOCKERFILE_PATH }}" -NextVersion $version
143+
} else {
144+
Write-Host "Skipping .NET 11 ARM64 update - No version detected"
145+
}
146+
117147
# Commit changes and create a branch
118148
- name: Commit and Push
119149
id: commit-push
@@ -159,25 +189,27 @@ jobs:
159189
destination_branch: "dev"
160190
pr_title: 'chore: Daily ASP.NET Core version update in Dockerfiles'
161191
pr_body: "This PR automatically updates the Dockerfiles to use the latest ASP.NET Core version.
162-
192+
163193
Verify that the Dockerfiles have correct versions and matching SHA512 checksums for ASP.NET Core runtime.
164-
194+
165195
All .NET versions: https://dotnet.microsoft.com/en-us/download/dotnet
166-
196+
167197
*Description of changes:*
168198
\n${{ format
169-
(
170-
'{0}\n{1}\n{2}\n{3}\n{4}\n{5}',
171-
join(steps.update-net8-amd64.outputs.MESSAGE, '\n'),
172-
join(steps.update-net8-arm64.outputs.MESSAGE, '\n'),
173-
join(steps.update-net9-amd64.outputs.MESSAGE, '\n'),
174-
join(steps.update-net9-arm64.outputs.MESSAGE, '\n'),
175-
join(steps.update-net10-amd64.outputs.MESSAGE, '\n'),
176-
join(steps.update-net10-arm64.outputs.MESSAGE, '\n')
177-
)
199+
(
200+
'{0}\n{1}\n{2}\n{3}\n{4}\n{5}\n{6}\n{7}',
201+
join(steps.update-net8-amd64.outputs.MESSAGE, '\n'),
202+
join(steps.update-net8-arm64.outputs.MESSAGE, '\n'),
203+
join(steps.update-net9-amd64.outputs.MESSAGE, '\n'),
204+
join(steps.update-net9-arm64.outputs.MESSAGE, '\n'),
205+
join(steps.update-net10-amd64.outputs.MESSAGE, '\n'),
206+
join(steps.update-net10-arm64.outputs.MESSAGE, '\n'),
207+
join(steps.update-net11-amd64.outputs.MESSAGE, '\n'),
208+
join(steps.update-net11-arm64.outputs.MESSAGE, '\n')
209+
)
178210
}}"
179211
github_token: ${{ secrets.GITHUB_TOKEN }}
180-
212+
181213
# Add "Release Not Needed" label to the PR
182214
- name: Add Release Not Needed label
183215
if: ${{ steps.pull-request.outputs.pr_number }}
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: Build Lambda Runtime Images
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- "LambdaRuntimeDockerfiles/**"
7+
push:
8+
paths:
9+
- "LambdaRuntimeDockerfiles/**"
10+
11+
permissions:
12+
contents: read
13+
14+
jobs:
15+
build-runtime-images:
16+
name: Build runtime image (${{ matrix.name }})
17+
runs-on: ubuntu-latest
18+
strategy:
19+
fail-fast: false
20+
matrix:
21+
include:
22+
- name: NET 8 AMD64
23+
dockerfile: LambdaRuntimeDockerfiles/Images/net8/amd64/Dockerfile
24+
platform: linux/amd64
25+
- name: NET 8 ARM64
26+
dockerfile: LambdaRuntimeDockerfiles/Images/net8/arm64/Dockerfile
27+
platform: linux/arm64
28+
- name: NET 9 AMD64
29+
dockerfile: LambdaRuntimeDockerfiles/Images/net9/amd64/Dockerfile
30+
platform: linux/amd64
31+
- name: NET 9 ARM64
32+
dockerfile: LambdaRuntimeDockerfiles/Images/net9/arm64/Dockerfile
33+
platform: linux/arm64
34+
- name: NET 10 AMD64
35+
dockerfile: LambdaRuntimeDockerfiles/Images/net10/amd64/Dockerfile
36+
platform: linux/amd64
37+
- name: NET 10 ARM64
38+
dockerfile: LambdaRuntimeDockerfiles/Images/net10/arm64/Dockerfile
39+
platform: linux/arm64
40+
- name: NET 11 AMD64
41+
dockerfile: LambdaRuntimeDockerfiles/Images/net11/amd64/Dockerfile
42+
platform: linux/amd64
43+
- name: NET 11 ARM64
44+
dockerfile: LambdaRuntimeDockerfiles/Images/net11/arm64/Dockerfile
45+
platform: linux/arm64
46+
47+
steps:
48+
- uses: actions/checkout@85e6279cec87321a52edac9c87bce653a07cf6c2 #v4.2.2
49+
50+
- name: Set up QEMU
51+
uses: docker/setup-qemu-action@v3
52+
53+
- name: Set up Docker Buildx
54+
uses: docker/setup-buildx-action@v3
55+
56+
- name: Build ${{ matrix.name }}
57+
uses: docker/build-push-action@v6
58+
with:
59+
context: .
60+
file: ${{ matrix.dockerfile }}
61+
platforms: ${{ matrix.platform }}
62+
push: false
63+
provenance: false
64+

.github/workflows/update-Dockerfiles.yml

Lines changed: 47 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,20 @@ on:
5050
description: ".NET 10 Next Version"
5151
type: string
5252
required: true
53+
NET_11_AMD64:
54+
description: ".NET 11 AMD64"
55+
type: boolean
56+
required: true
57+
default: true
58+
NET_11_ARM64:
59+
description: ".NET 11 ARM64"
60+
type: boolean
61+
required: true
62+
default: true
63+
NET_11_NEXT_VERSION:
64+
description: ".NET 11 Next Version"
65+
type: string
66+
required: true
5367

5468
jobs:
5569
build:
@@ -61,6 +75,8 @@ jobs:
6175
NET_9_ARM64_Dockerfile: "LambdaRuntimeDockerfiles/Images/net9/arm64/Dockerfile"
6276
NET_10_AMD64_Dockerfile: "LambdaRuntimeDockerfiles/Images/net10/amd64/Dockerfile"
6377
NET_10_ARM64_Dockerfile: "LambdaRuntimeDockerfiles/Images/net10/arm64/Dockerfile"
78+
NET_11_AMD64_Dockerfile: "LambdaRuntimeDockerfiles/Images/net11/amd64/Dockerfile"
79+
NET_11_ARM64_Dockerfile: "LambdaRuntimeDockerfiles/Images/net11/arm64/Dockerfile"
6480

6581
# Steps represent a sequence of tasks that will be executed as part of the job
6682
steps:
@@ -129,6 +145,26 @@ jobs:
129145
.\LambdaRuntimeDockerfiles\update-dockerfile.ps1 -DockerfilePath "${{ env.DOCKERFILE_PATH }}" -NextVersion "${{ env.NEXT_VERSION }}"
130146
if: ${{ github.event.inputs.NET_10_ARM64 == 'true' }}
131147

148+
- name: Update .NET 11 AMD64
149+
id: update-net11-amd64
150+
shell: pwsh
151+
env:
152+
DOCKERFILE_PATH: ${{ env.NET_11_AMD64_Dockerfile }}
153+
NEXT_VERSION: ${{ github.event.inputs.NET_11_NEXT_VERSION }}
154+
run: |
155+
.\LambdaRuntimeDockerfiles\update-dockerfile.ps1 -DockerfilePath "${{ env.DOCKERFILE_PATH }}" -NextVersion "${{ env.NEXT_VERSION }}"
156+
if: ${{ github.event.inputs.NET_11_AMD64 == 'true' }}
157+
158+
- name: Update .NET 11 ARM64
159+
id: update-net11-arm64
160+
shell: pwsh
161+
env:
162+
DOCKERFILE_PATH: ${{ env.NET_11_ARM64_Dockerfile }}
163+
NEXT_VERSION: ${{ github.event.inputs.NET_11_NEXT_VERSION }}
164+
run: |
165+
.\LambdaRuntimeDockerfiles\update-dockerfile.ps1 -DockerfilePath "${{ env.DOCKERFILE_PATH }}" -NextVersion "${{ env.NEXT_VERSION }}"
166+
if: ${{ github.event.inputs.NET_11_ARM64 == 'true' }}
167+
132168
# Update Dockerfiles if newer version of ASP.NET Core is available
133169
- name: Commit and Push
134170
id: commit-push
@@ -158,15 +194,17 @@ jobs:
158194
\n\nAll .NET versions https://dotnet.microsoft.com/en-us/download/dotnet
159195
\n\n*Description of changes:*
160196
\n${{ format
161-
(
162-
'{0}\n{1}\n{2}\n{3}\n{4}\n{5}',
163-
join(steps.update-net8-amd64.outputs.MESSAGE, '\n'),
164-
join(steps.update-net8-arm64.outputs.MESSAGE, '\n'),
165-
join(steps.update-net9-amd64.outputs.MESSAGE, '\n'),
166-
join(steps.update-net9-arm64.outputs.MESSAGE, '\n'),
167-
join(steps.update-net10-amd64.outputs.MESSAGE, '\n'),
168-
join(steps.update-net10-arm64.outputs.MESSAGE, '\n')
169-
)
197+
(
198+
'{0}\n{1}\n{2}\n{3}\n{4}\n{5}\n{6}\n{7}',
199+
join(steps.update-net8-amd64.outputs.MESSAGE, '\n'),
200+
join(steps.update-net8-arm64.outputs.MESSAGE, '\n'),
201+
join(steps.update-net9-amd64.outputs.MESSAGE, '\n'),
202+
join(steps.update-net9-arm64.outputs.MESSAGE, '\n'),
203+
join(steps.update-net10-amd64.outputs.MESSAGE, '\n'),
204+
join(steps.update-net10-arm64.outputs.MESSAGE, '\n'),
205+
join(steps.update-net11-amd64.outputs.MESSAGE, '\n'),
206+
join(steps.update-net11-arm64.outputs.MESSAGE, '\n')
207+
)
170208
}}"
171209
github_token: ${{ secrets.GITHUB_TOKEN }}
172210

LambdaRuntimeDockerfiles/Images/net10/amd64/Dockerfile

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,21 +27,20 @@ RUN curl -SL --output aspnetcore.tar.gz https://builds.dotnet.microsoft.com/dotn
2727
&& rm aspnetcore.tar.gz
2828

2929

30-
FROM mcr.microsoft.com/dotnet/sdk:10.0-preview-trixie-slim AS builder
30+
FROM mcr.microsoft.com/dotnet/sdk:10.0-noble AS builder
3131
WORKDIR /src
3232
COPY ["Libraries/src/Amazon.Lambda.RuntimeSupport", "Repo/Libraries/src/Amazon.Lambda.RuntimeSupport/"]
3333
COPY ["Libraries/src/SnapshotRestore.Registry", "Repo/Libraries/src/SnapshotRestore.Registry/"]
3434
COPY ["Libraries/src/Amazon.Lambda.Core", "Repo/Libraries/src/Amazon.Lambda.Core/"]
3535
COPY ["buildtools/", "Repo/buildtools/"]
3636
RUN dotnet restore "Repo/Libraries/src/Amazon.Lambda.RuntimeSupport/Amazon.Lambda.RuntimeSupport.csproj" /p:TargetFrameworks=net10.0
37-
WORKDIR "Repo/Libraries/src/Amazon.Lambda.RuntimeSupport"
37+
WORKDIR /src/Repo/Libraries/src/Amazon.Lambda.RuntimeSupport
3838
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
3939

4040

4141
FROM builder AS publish
4242
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
43-
RUN apt-get update && apt-get install -y dos2unix
44-
RUN dos2unix /app/publish/bootstrap.sh && \
43+
RUN sed -i 's/\r$//' /app/publish/bootstrap.sh && \
4544
mv /app/publish/bootstrap.sh /app/publish/bootstrap && \
4645
chmod +x /app/publish/bootstrap
4746
RUN touch /app/publish/empty-certificates.crt

LambdaRuntimeDockerfiles/Images/net10/arm64/Dockerfile

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,21 +27,20 @@ RUN curl -SL --output aspnetcore.tar.gz https://builds.dotnet.microsoft.com/dotn
2727
&& rm aspnetcore.tar.gz
2828

2929

30-
FROM mcr.microsoft.com/dotnet/sdk:10.0-preview-trixie-slim AS builder
30+
FROM mcr.microsoft.com/dotnet/sdk:10.0-noble AS builder
3131
WORKDIR /src
3232
COPY ["Libraries/src/Amazon.Lambda.RuntimeSupport", "Repo/Libraries/src/Amazon.Lambda.RuntimeSupport/"]
3333
COPY ["Libraries/src/SnapshotRestore.Registry", "Repo/Libraries/src/SnapshotRestore.Registry/"]
3434
COPY ["Libraries/src/Amazon.Lambda.Core", "Repo/Libraries/src/Amazon.Lambda.Core/"]
3535
COPY ["buildtools/", "Repo/buildtools/"]
3636
RUN dotnet restore "Repo/Libraries/src/Amazon.Lambda.RuntimeSupport/Amazon.Lambda.RuntimeSupport.csproj" /p:TargetFrameworks=net10.0
37-
WORKDIR "Repo/Libraries/src/Amazon.Lambda.RuntimeSupport"
37+
WORKDIR /src/Repo/Libraries/src/Amazon.Lambda.RuntimeSupport
3838
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
3939

4040

4141
FROM builder AS publish
4242
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
43-
RUN apt-get update && apt-get install -y dos2unix
44-
RUN dos2unix /app/publish/bootstrap.sh && \
43+
RUN sed -i 's/\r$//' /app/publish/bootstrap.sh && \
4544
mv /app/publish/bootstrap.sh /app/publish/bootstrap && \
4645
chmod +x /app/publish/bootstrap
4746
RUN touch /app/publish/empty-certificates.crt
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
# Based on Docker image from: https://github.com/dotnet/dotnet-docker/
2+
3+
ARG ASPNET_VERSION=11.0.0-preview.2.26159.112
4+
ARG ASPNET_SHA512=4c02fbb66bc4b7389e0f43c0ea96a3046954eb3c7ad06bf0f8d90997c2e603dd0a3929e2b29b9e8933cc76341fb5e62ebe5bcb83d9a31419bdd1195904ff5af6
5+
6+
ARG LAMBDA_RUNTIME_NAME=dotnet11
7+
ARG AMAZON_LINUX=public.ecr.aws/lambda/provided:al2023
8+
9+
FROM $AMAZON_LINUX AS base
10+
11+
RUN dnf install libicu-67.1-7.amzn2023.0.4.x86_64 --assumeyes
12+
13+
FROM base AS builder-net11
14+
ARG ASPNET_VERSION
15+
ARG ASPNET_SHA512
16+
17+
WORKDIR /dotnet
18+
19+
# Install tar and gzip for unarchiving downloaded tar.gz
20+
RUN dnf install tar gzip --assumeyes
21+
22+
# Install the ASP.NET Core shared framework
23+
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 \
24+
&& aspnetcore_sha512=$ASPNET_SHA512 \
25+
&& echo "$aspnetcore_sha512 aspnetcore.tar.gz" | sha512sum -c - \
26+
&& tar -ozxf aspnetcore.tar.gz -C /dotnet \
27+
&& rm aspnetcore.tar.gz
28+
29+
30+
FROM mcr.microsoft.com/dotnet/sdk:11.0-preview-resolute AS builder
31+
WORKDIR /src
32+
COPY ["Libraries/src/Amazon.Lambda.RuntimeSupport", "Repo/Libraries/src/Amazon.Lambda.RuntimeSupport/"]
33+
COPY ["Libraries/src/SnapshotRestore.Registry", "Repo/Libraries/src/SnapshotRestore.Registry/"]
34+
COPY ["Libraries/src/Amazon.Lambda.Core", "Repo/Libraries/src/Amazon.Lambda.Core/"]
35+
COPY ["buildtools/", "Repo/buildtools/"]
36+
RUN dotnet restore "Repo/Libraries/src/Amazon.Lambda.RuntimeSupport/Amazon.Lambda.RuntimeSupport.csproj" /p:TargetFrameworks=net11.0
37+
WORKDIR /src/Repo/Libraries/src/Amazon.Lambda.RuntimeSupport
38+
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
39+
40+
41+
FROM builder AS publish
42+
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
43+
RUN sed -i 's/\r$//' /app/publish/bootstrap.sh && \
44+
mv /app/publish/bootstrap.sh /app/publish/bootstrap && \
45+
chmod +x /app/publish/bootstrap
46+
RUN touch /app/publish/empty-certificates.crt
47+
48+
49+
FROM base
50+
51+
ARG ASPNET_VERSION
52+
ARG LAMBDA_RUNTIME_NAME
53+
54+
ENV \
55+
# Export .NET version as environment variable
56+
DOTNET_VERSION=$ASPNET_VERSION \
57+
# Enable detection of running in a container
58+
DOTNET_RUNNING_IN_CONTAINER=true \
59+
# Lambda is opinionated about installing tooling under /var
60+
DOTNET_ROOT=/var/lang/bin \
61+
# Don't display welcome message on first run
62+
DOTNET_NOLOGO=true \
63+
# Disable Microsoft's telemetry collection
64+
DOTNET_CLI_TELEMETRY_OPTOUT=true
65+
66+
COPY --from=builder-net11 /dotnet ${DOTNET_ROOT}
67+
COPY --from=publish /app/publish ${LAMBDA_RUNTIME_DIR}
68+
69+
# Generate runtime-release file
70+
RUN export BUILD_TIMESTAMP=$(printf '%x' $(date +%s)) && \
71+
export LOGGING_PROTOCOL="LOGGING=amzn-stdout-tlv" && \
72+
export LAMBDA_RUNTIME_NAME="LAMBDA_RUNTIME_NAME=${LAMBDA_RUNTIME_NAME}" && \
73+
echo -e "NAME=dotnet\nVERSION=${ASPNET_VERSION}-${BUILD_TIMESTAMP}\n${LOGGING_PROTOCOL}\n${LAMBDA_RUNTIME_NAME}\n" > ${LAMBDA_RUNTIME_DIR}/runtime-release
74+
75+
# Entrypoint is inherited from public.ecr.aws/lambda/provided

0 commit comments

Comments
 (0)