Skip to content

Commit e33a9e8

Browse files
committedNov 11, 2024
feat: update lambda container images and test tool to .NET9
1 parent 9b3eda9 commit e33a9e8

24 files changed

+654
-653
lines changed
 

‎.autover/autover.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,8 @@
124124
"Paths": [
125125
"Tools/LambdaTestTool/src/Amazon.Lambda.TestTool.BlazorTester/Amazon.Lambda.TestTool.BlazorTester.csproj",
126126
"Tools/LambdaTestTool/src/Amazon.Lambda.TestTool.BlazorTester/Amazon.Lambda.TestTool.BlazorTester60-pack.csproj",
127-
"Tools/LambdaTestTool/src/Amazon.Lambda.TestTool.BlazorTester/Amazon.Lambda.TestTool.BlazorTester70-pack.csproj",
128-
"Tools/LambdaTestTool/src/Amazon.Lambda.TestTool.BlazorTester/Amazon.Lambda.TestTool.BlazorTester80-pack.csproj"
127+
"Tools/LambdaTestTool/src/Amazon.Lambda.TestTool.BlazorTester/Amazon.Lambda.TestTool.BlazorTester80-pack.csproj",
128+
"Tools/LambdaTestTool/src/Amazon.Lambda.TestTool.BlazorTester/Amazon.Lambda.TestTool.BlazorTester90-pack.csproj"
129129
]
130130
}
131131
],
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"Projects": [
3+
{
4+
"Name": "Amazon.Lambda.TestTool.BlazorTester",
5+
"Type": "Minor",
6+
"ChangelogMessages": [
7+
"Update Lambda Test Tool to add a .NET9 target"
8+
]
9+
}
10+
]
11+
}

‎LambdaRuntimeDockerfiles/Images/net7/amd64/Dockerfile renamed to ‎LambdaRuntimeDockerfiles/Images/net9/amd64/Dockerfile

+16-13
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,23 @@
11
# Based on Docker image from: https://github.com/dotnet/dotnet-docker/
22

3-
ARG ASPNET_VERSION=7.0.20
4-
ARG ASPNET_SHA512=62ed9743972043a72e48d5aa2f7fdf3483cf684a32b051315004d1c778e9712bf66e5e7a97a5a53993fa8e92daf5bacaf2cdb3eae44bb9a9e25532b9a80f4f70
3+
ARG ASPNET_VERSION=9.0.0-rc.2.24474.3
4+
ARG ASPNET_SHA512=9370c26174cd7f1b2fef58e0a53041c94b7d5412f15ea5865fbc653a65b148b1f92e7992f147610a6ca2e92011ff28c43480ab26a6e7f8cd56f2189af0610be8
55

6-
ARG LAMBDA_RUNTIME_NAME=dotnet7
7-
ARG AMAZON_LINUX=public.ecr.aws/lambda/provided:al2
6+
ARG LAMBDA_RUNTIME_NAME=dotnet9
7+
ARG AMAZON_LINUX=public.ecr.aws/lambda/provided:al2023
88

99
FROM $AMAZON_LINUX AS base
1010

11-
FROM base AS builder-net7
11+
RUN dnf install libicu-67.1-7.amzn2023.0.3.x86_64 --assumeyes
12+
13+
FROM base AS builder-net9
1214
ARG ASPNET_VERSION
1315
ARG ASPNET_SHA512
1416

1517
WORKDIR /dotnet
1618

1719
# Install tar and gzip for unarchiving downloaded tar.gz
18-
RUN yum install tar gzip --assumeyes
20+
RUN dnf install tar gzip --assumeyes
1921

2022
# Install the ASP.NET Core shared framework
2123
RUN curl -SL --output aspnetcore.tar.gz https://dotnetcli.azureedge.net/dotnet/aspnetcore/Runtime/$ASPNET_VERSION/aspnetcore-runtime-$ASPNET_VERSION-linux-x64.tar.gz \
@@ -25,22 +27,23 @@ RUN curl -SL --output aspnetcore.tar.gz https://dotnetcli.azureedge.net/dotnet/a
2527
&& rm aspnetcore.tar.gz
2628

2729

28-
FROM mcr.microsoft.com/dotnet/sdk:7.0-bullseye-slim AS builder
30+
FROM mcr.microsoft.com/dotnet/sdk:9.0-bookworm-slim AS builder
2931
WORKDIR /src
3032
COPY ["Libraries/src/Amazon.Lambda.RuntimeSupport", "Repo/Libraries/src/Amazon.Lambda.RuntimeSupport/"]
3133
COPY ["Libraries/src/Amazon.Lambda.Core", "Repo/Libraries/src/Amazon.Lambda.Core/"]
3234
COPY ["buildtools/", "Repo/buildtools/"]
33-
RUN dotnet restore "Repo/Libraries/src/Amazon.Lambda.RuntimeSupport/Amazon.Lambda.RuntimeSupport.csproj" /p:TargetFrameworks=net7.0
35+
RUN dotnet restore "Repo/Libraries/src/Amazon.Lambda.RuntimeSupport/Amazon.Lambda.RuntimeSupport.csproj" /p:TargetFrameworks=net9.0
3436
WORKDIR "Repo/Libraries/src/Amazon.Lambda.RuntimeSupport"
35-
RUN dotnet build "Amazon.Lambda.RuntimeSupport.csproj" /p:ExecutableOutputType=true /p:GenerateDocumentationFile=false /p:TargetFrameworks=net7.0 --runtime linux-x64 -c Release -o /app/build
37+
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
3638

3739

3840
FROM builder AS publish
39-
RUN dotnet publish "Amazon.Lambda.RuntimeSupport.csproj" /p:ExecutableOutputType=true /p:GenerateDocumentationFile=false /p:TargetFrameworks=net7.0 -f net7.0 --runtime linux-x64 --self-contained false -p:PublishReadyToRun=true -c Release -o /app/publish
41+
RUN dotnet publish "Amazon.Lambda.RuntimeSupport.csproj" /p:ExecutableOutputType=true /p:GenerateDocumentationFile=false /p:TargetFrameworks=net9.0 -f net9.0 --runtime linux-x64 --self-contained false -p:PublishReadyToRun=true -c Release -o /app/publish
4042
RUN apt-get update && apt-get install -y dos2unix
41-
RUN dos2unix /app/publish/bootstrap.sh && \
42-
mv /app/publish/bootstrap.sh /app/publish/bootstrap && \
43+
RUN dos2unix /app/publish/bootstrap-al2023.sh && \
44+
mv /app/publish/bootstrap-al2023.sh /app/publish/bootstrap && \
4345
chmod +x /app/publish/bootstrap
46+
RUN touch /app/publish/empty-certificates.crt
4447

4548

4649
FROM base
@@ -60,7 +63,7 @@ ENV \
6063
# Disable Microsoft's telemetry collection
6164
DOTNET_CLI_TELEMETRY_OPTOUT=true
6265

63-
COPY --from=builder-net7 /dotnet ${DOTNET_ROOT}
66+
COPY --from=builder-net9 /dotnet ${DOTNET_ROOT}
6467
COPY --from=publish /app/publish ${LAMBDA_RUNTIME_DIR}
6568

6669
# Generate runtime-release file

‎LambdaRuntimeDockerfiles/Images/net7/arm64/Dockerfile renamed to ‎LambdaRuntimeDockerfiles/Images/net9/arm64/Dockerfile

+16-46
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,23 @@
11
# Based on Docker image from: https://github.com/dotnet/dotnet-docker/
22

3-
ARG ASPNET_VERSION=7.0.20
4-
ARG ASPNET_SHA512=dfb1c1bef4d826defd3d995599a5c03e1bf1a64c65d98b675d6c05dbb7380d98233953e68d53fc5ebec60ad4ef75417073fb1fb3256a0176bb964f0e01161f6c
3+
ARG ASPNET_VERSION=9.0.0-rc.2.24474.3
4+
ARG ASPNET_SHA512=b6de668ce8714476be78ae00ed66027f3a5b06d95c6768ad6b3eca4d0f396c91843267c0e8c03160b709a7acdcbc2b09047f1ec8d46309d40c3d31f849cc981f
55

6-
ARG ICU_VERSION=68.1
7-
ARG ICU_MD5=6a99b541ea01f271257b121a4433c7c0
8-
9-
ARG LAMBDA_RUNTIME_NAME=dotnet7
10-
ARG AMAZON_LINUX=public.ecr.aws/lambda/provided:al2
6+
ARG LAMBDA_RUNTIME_NAME=dotnet9
7+
ARG AMAZON_LINUX=public.ecr.aws/lambda/provided:al2023
118

129
FROM $AMAZON_LINUX AS base
1310

14-
FROM base AS builder-libicu
15-
WORKDIR /
16-
17-
# Install depedencies to extract and build ICU library
18-
RUN yum install -d1 -y \
19-
tar \
20-
gzip \
21-
make \
22-
gcc-c++
23-
24-
# Download, validate and extract ICU library
25-
# https://github.com/unicode-org/icu/releases/tag/release-68-1
26-
ARG ICU_VERSION
27-
ARG ICU_MD5
28-
RUN curl -SL https://github.com/unicode-org/icu/releases/download/release-${ICU_VERSION//./-}/icu4c-${ICU_VERSION//./_}-src.tgz -o icu-src.tgz \
29-
&& echo "$ICU_MD5 icu-src.tgz" | md5sum -c - \
30-
&& tar -xzf icu-src.tgz \
31-
&& rm icu-src.tgz
32-
33-
# Build ICU library
34-
RUN mkdir /libicu
35-
WORKDIR /icu/source/
36-
RUN ./configure --prefix=/libicu \
37-
&& make \
38-
&& make install
39-
40-
41-
FROM base AS builder-net7
11+
RUN dnf install libicu-67.1-7.amzn2023.0.3.aarch64 --assumeyes
12+
13+
FROM base AS builder-net9
4214
ARG ASPNET_VERSION
4315
ARG ASPNET_SHA512
4416

4517
WORKDIR /dotnet
4618

4719
# Install tar and gzip for unarchiving downloaded tar.gz
48-
RUN yum install tar gzip --assumeyes
20+
RUN dnf install tar gzip --assumeyes
4921

5022
# Install the ASP.NET Core shared framework
5123
RUN curl -SL --output aspnetcore.tar.gz https://dotnetcli.azureedge.net/dotnet/aspnetcore/Runtime/$ASPNET_VERSION/aspnetcore-runtime-$ASPNET_VERSION-linux-arm64.tar.gz \
@@ -55,25 +27,23 @@ RUN curl -SL --output aspnetcore.tar.gz https://dotnetcli.azureedge.net/dotnet/a
5527
&& rm aspnetcore.tar.gz
5628

5729

58-
FROM mcr.microsoft.com/dotnet/sdk:7.0-bullseye-slim AS builder
30+
FROM mcr.microsoft.com/dotnet/sdk:9.0-bookworm-slim AS builder
5931
WORKDIR /src
6032
COPY ["Libraries/src/Amazon.Lambda.RuntimeSupport", "Repo/Libraries/src/Amazon.Lambda.RuntimeSupport/"]
6133
COPY ["Libraries/src/Amazon.Lambda.Core", "Repo/Libraries/src/Amazon.Lambda.Core/"]
6234
COPY ["buildtools/", "Repo/buildtools/"]
63-
RUN dotnet restore "Repo/Libraries/src/Amazon.Lambda.RuntimeSupport/Amazon.Lambda.RuntimeSupport.csproj" /p:TargetFrameworks=net7.0
35+
RUN dotnet restore "Repo/Libraries/src/Amazon.Lambda.RuntimeSupport/Amazon.Lambda.RuntimeSupport.csproj" /p:TargetFrameworks=net9.0
6436
WORKDIR "Repo/Libraries/src/Amazon.Lambda.RuntimeSupport"
65-
RUN dotnet build "Amazon.Lambda.RuntimeSupport.csproj" /p:ExecutableOutputType=true /p:GenerateDocumentationFile=false /p:TargetFrameworks=net7.0 --runtime linux-arm64 -c Release -o /app/build
37+
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
6638

6739

6840
FROM builder AS publish
69-
RUN dotnet publish "Amazon.Lambda.RuntimeSupport.csproj" /p:ExecutableOutputType=true /p:GenerateDocumentationFile=false /p:TargetFrameworks=net7.0 -f net7.0 --runtime linux-arm64 --self-contained false -p:PublishReadyToRun=true -c Release -o /app/publish
41+
RUN dotnet publish "Amazon.Lambda.RuntimeSupport.csproj" /p:ExecutableOutputType=true /p:GenerateDocumentationFile=false /p:TargetFrameworks=net9.0 -f net9.0 --runtime linux-arm64 --self-contained false -p:PublishReadyToRun=true -c Release -o /app/publish
7042
RUN apt-get update && apt-get install -y dos2unix
71-
RUN dos2unix /app/publish/bootstrap.sh && \
72-
mv /app/publish/bootstrap.sh /app/publish/bootstrap && \
43+
RUN dos2unix /app/publish/bootstrap-al2023.sh && \
44+
mv /app/publish/bootstrap-al2023.sh /app/publish/bootstrap && \
7345
chmod +x /app/publish/bootstrap
74-
75-
# Copy native dependencies
76-
COPY --from=builder-libicu /libicu /app/publish
46+
RUN touch /app/publish/empty-certificates.crt
7747

7848

7949
FROM base
@@ -93,7 +63,7 @@ ENV \
9363
# Disable Microsoft's telemetry collection
9464
DOTNET_CLI_TELEMETRY_OPTOUT=true
9565

96-
COPY --from=builder-net7 /dotnet ${DOTNET_ROOT}
66+
COPY --from=builder-net9 /dotnet ${DOTNET_ROOT}
9767
COPY --from=publish /app/publish ${LAMBDA_RUNTIME_DIR}
9868

9969
# Generate runtime-release file

‎LambdaRuntimeDockerfiles/Infrastructure/README.md

+9-14
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Infrastructure project allows to create pipeline to build and push .NET Lambda R
88
2. [AWS Account and User](https://portal.aws.amazon.com/billing/signup)
99
3. [Node.js](https://nodejs.org/)
1010
4. [AWS CDK Toolkit](https://www.npmjs.com/package/aws-cdk)
11-
5. [.NET Core 3.1 SDK or above](https://dotnet.microsoft.com/download)
11+
5. [.NET 8 SDK or above](https://dotnet.microsoft.com/download)
1212

1313
### Bootstrap
1414

@@ -17,33 +17,28 @@ Infrastructure project allows to create pipeline to build and push .NET Lambda R
1717
```powershell
1818
.\bootstrap.ps1 `
1919
-PipelineAccountId "AccountId" `
20-
-CodeCommitAccountId "CodeCommitAccountId" `
21-
-Profile "AccountProfile" `
22-
-CodeCommitAccountProfile "CodeCommitAccountProfile" `
2320
-Region "AwsRegion" `
24-
-SourceRepositoryArn "arn:aws:codecommit:us-west-2:CodeCommitAccountId:aws-lambda-dotnet" `
25-
-SourceBranchName "main" `
21+
-GitHubTokenSecretName "SecretName" `
22+
-GitHubTokenSecretKey "Key" `
23+
-GitHubRepoOwner "GitHubOwner" `
24+
-GitHubRepoName "GitHubRepo" `
25+
-GitHubRepoBranch "GitHubBranch" `
2626
-StageEcr "AccountId.dkr.ecr.us-west-2.amazonaws.com" `
2727
-BetaEcrs "AccountId.dkr.ecr.us-west-2.amazonaws.com;AccountId.dkr.ecr.us-west-2.amazonaws.com" `
2828
-ProdEcrs "AccountId.dkr.ecr.us-west-2.amazonaws.com;AccountId.dkr.ecr.us-west-2.amazonaws.com" `
29-
-EcrRepositoryName "awslambda/dotnet6.0-runtime;awslambda/dotnet7-runtime;awslambda/dotnet8-runtime" `
30-
-TargetFramework "net6;net7;net8" `
31-
-DotnetChannel "6.0;7.0;8.0"
29+
-EcrRepositoryName "awslambda/dotnet6.0-runtime;awslambda/dotnet8-runtime;awslambda/dotnet9-runtime" `
30+
-TargetFramework "net6;net8;net9" `
31+
-DotnetChannel "6.0;8.0;9.0"
3232
```
3333

3434
#### Notes
3535
- AWS Profiles used to execute `bootstrap.ps1` must have administrator access.
3636
- All resources used to bootstrap the pipeline must already exist.
3737
- `AccountId` is AWS AccountId used for deploying CDK App.
38-
- `CodeCommitAccountId` is AWS AccountId that contains source repository.
39-
- If the CodeCommit repository is in the same account, use the same account Id for `PipelineAccountId` and `CodeCommitAccountId`.
40-
- When doing a cross-account deployment, you need to have AWS Profiles for both accounts.
41-
- `bootstrap.ps1` will run 2 `cdk bootstrap` commands for the cross account deployments to establish a trust relationships between the accounts. This way, we do not require a separate IAM role to be created manually.
4238

4339
## Useful commands
4440
* `npx cdk bootstrap --cloudformation-execution-policies arn:aws:iam::aws:policy/AdministratorAccess` bootstrap this app
4541
* `dotnet build` compile this app
4642
* `cdk deploy` deploy this stack to your default AWS account/region
4743
* `cdk diff` compare deployed stack with current state
4844
* `cdk synth` emits the synthesized CloudFormation template
49-

‎LambdaRuntimeDockerfiles/Infrastructure/src/Infrastructure/Configuration.cs

+30-33
Original file line numberDiff line numberDiff line change
@@ -16,41 +16,38 @@
1616
using System;
1717
using System.Collections.Generic;
1818

19-
namespace Infrastructure
19+
namespace Infrastructure;
20+
21+
internal class Configuration
2022
{
21-
internal class Configuration
22-
{
23-
public string AccountId { get; } = Environment.GetEnvironmentVariable("AWS_LAMBDA_PIPELINE_ACCOUNT_ID");
24-
public string CodeCommitAccountId { get; } = Environment.GetEnvironmentVariable("AWS_LAMBDA_PIPELINE_CODECOMMIT_ACCOUNT_ID");
25-
public string Region { get; } = Environment.GetEnvironmentVariable("AWS_LAMBDA_PIPELINE_REGION");
23+
public string AccountId { get; } = Environment.GetEnvironmentVariable("AWS_LAMBDA_PIPELINE_ACCOUNT_ID");
24+
public string Region { get; } = Environment.GetEnvironmentVariable("AWS_LAMBDA_PIPELINE_REGION");
2625

27-
public Source Source { get; } = new Source();
28-
public Ecrs Ecrs { get; } = new Ecrs();
29-
public readonly string[] EcrRepositoryNames = Environment.GetEnvironmentVariable("AWS_LAMBDA_ECR_REPOSITORY_NAME")?.Split(";");
30-
public const string ProjectRoot = "LambdaRuntimeDockerfiles/Infrastructure/src/Infrastructure";
31-
public const string ProjectName = "aws-lambda-container-images";
32-
public readonly string[] DockerARM64Images = new string[] { "net6", "net7", "net8" };
33-
// DotnetSdkVersions is used to specify a specific version of the .NET SDK to be installed on the CodeBuild image
34-
// The default behavior is to specify a channel and that installs the latest version in that channel
35-
// By specifying a specific .NET SDK version, you override the default channel behavior
36-
public readonly Dictionary<string, string> DotnetSdkVersions = new Dictionary<string, string> { };
37-
public readonly Dictionary<string, string> DockerBuildImages = new Dictionary<string, string> { {"net6", "6.0-bullseye-slim"}, {"net7", "7.0-bullseye-slim"}, {"net8", "8.0-bookworm-slim"} };
38-
public readonly Dictionary<string, string> BaseImageAMD64Tags = new Dictionary<string, string> { { "net6", "contributed-base-image-x86_64" }, { "net7", "contributed-base-image-x86_64" }, { "net8", "contributed-base-image-x86_64" } };
39-
public readonly Dictionary<string, string> BaseImageARM64Tags = new Dictionary<string, string> { { "net6", "contributed-base-image-arm64" }, { "net7", "contributed-base-image-arm64" }, { "net8", "contributed-base-image-arm64" } };
40-
public readonly string[] Frameworks = Environment.GetEnvironmentVariable("AWS_LAMBDA_DOTNET_FRAMEWORK_VERSION")?.Split(";");
41-
public readonly string[] Channels = Environment.GetEnvironmentVariable("AWS_LAMBDA_DOTNET_FRAMEWORK_CHANNEL")?.Split(";");
42-
}
26+
public string GitHubTokenSecretName { get; } = Environment.GetEnvironmentVariable("AWS_LAMBDA_GITHUB_TOKEN_SECRET_NAME");
4327

44-
internal class Source
45-
{
46-
public string RepositoryArn { get; } = Environment.GetEnvironmentVariable("AWS_LAMBDA_SOURCE_REPOSITORY_ARN");
47-
public string BranchName { get; } = Environment.GetEnvironmentVariable("AWS_LAMBDA_SOURCE_BRANCH_NAME");
48-
}
28+
public string GitHubTokenSecretKey { get; } = Environment.GetEnvironmentVariable("AWS_LAMBDA_GITHUB_TOKEN_SECRET_KEY");
29+
public string GitHubOwner { get; } = Environment.GetEnvironmentVariable("AWS_LAMBDA_GITHUB_REPO_OWNER");
30+
public string GitHubRepository { get; } = Environment.GetEnvironmentVariable("AWS_LAMBDA_GITHUB_REPO_NAME");
31+
public string GitHubBranch { get; } = Environment.GetEnvironmentVariable("AWS_LAMBDA_GITHUB_REPO_BRANCH");
32+
public Ecrs Ecrs { get; } = new Ecrs();
33+
public readonly string[] EcrRepositoryNames = Environment.GetEnvironmentVariable("AWS_LAMBDA_ECR_REPOSITORY_NAME")?.Split(";");
34+
public const string ProjectRoot = "LambdaRuntimeDockerfiles/Infrastructure/src/Infrastructure";
35+
public static readonly string ProjectName = $"aws-lambda-container-images{Environment.GetEnvironmentVariable("AWS_LAMBDA_PIPELINE_NAME_SUFFIX")}";
36+
public readonly string[] DockerArm64Images = new string[] { "net6", "net8", "net9" };
37+
// DotnetSdkVersions is used to specify a specific version of the .NET SDK to be installed on the CodeBuild image
38+
// The default behavior is to specify a channel and that installs the latest version in that channel
39+
// By specifying a specific .NET SDK version, you override the default channel behavior
40+
public readonly Dictionary<string, string> DotnetSdkVersions = new Dictionary<string, string> { };
41+
public readonly Dictionary<string, string> DockerBuildImages = new Dictionary<string, string> { {"net6", "6.0-bullseye-slim"}, {"net8", "8.0-bookworm-slim"}, {"net9", "9.0-bookworm-slim"} };
42+
public readonly Dictionary<string, string> BaseImageAmd64Tags = new Dictionary<string, string> { { "net6", "contributed-base-image-x86_64" }, { "net8", "contributed-base-image-x86_64" }, { "net9", "contributed-base-image-x86_64" } };
43+
public readonly Dictionary<string, string> BaseImageArm64Tags = new Dictionary<string, string> { { "net6", "contributed-base-image-arm64" }, { "net8", "contributed-base-image-arm64" }, { "net9", "contributed-base-image-arm64" } };
44+
public readonly string[] Frameworks = Environment.GetEnvironmentVariable("AWS_LAMBDA_DOTNET_FRAMEWORK_VERSION")?.Split(";");
45+
public readonly string[] Channels = Environment.GetEnvironmentVariable("AWS_LAMBDA_DOTNET_FRAMEWORK_CHANNEL")?.Split(";");
46+
}
4947

50-
internal class Ecrs
51-
{
52-
public string Stage { get; } = Environment.GetEnvironmentVariable("AWS_LAMBDA_STAGE_ECR");
53-
public string Beta { get; } = Environment.GetEnvironmentVariable("AWS_LAMBDA_BETA_ECRS");
54-
public string Prod { get; } = Environment.GetEnvironmentVariable("AWS_LAMBDA_PROD_ECRS");
55-
}
48+
internal class Ecrs
49+
{
50+
public string Stage { get; } = Environment.GetEnvironmentVariable("AWS_LAMBDA_STAGE_ECR");
51+
public string Beta { get; } = Environment.GetEnvironmentVariable("AWS_LAMBDA_BETA_ECRS");
52+
public string Prod { get; } = Environment.GetEnvironmentVariable("AWS_LAMBDA_PROD_ECRS");
5653
}

‎LambdaRuntimeDockerfiles/Infrastructure/src/Infrastructure/DockerBuild/build.ps1

+10
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,16 @@ if (!$?)
2828

2929
$SourceNameTagPair = "aws-lambda-${Framework}:latest"
3030

31+
# Check if the repository exists
32+
aws ecr describe-repositories --repository-names $EcrRepositoryName --region $StageRegion
33+
if (!$?) {
34+
Write-Output "Repository '$EcrRepositoryName' does not exist. Creating it..."
35+
aws ecr create-repository --repository-name $EcrRepositoryName --region $StageRegion
36+
}
37+
else {
38+
Write-Output "Repository '$EcrRepositoryName' exists."
39+
}
40+
3141
# Build runtime docker image
3242
try
3343
{

‎LambdaRuntimeDockerfiles/Infrastructure/src/Infrastructure/DockerBuild/buildspec.yml

+3-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ version: 0.2
22
phases:
33
pre_build:
44
commands:
5+
# Find and delete the global.json files that were added by CodeBuild. This causes issues when multiple SDKs are installed.
6+
- find / -type f -name 'global.json' -delete
57
- |
68
if [ "$AWS_LAMBDA_DOTNET_SDK_VERSION" = "" ]; then
79
curl -sSL https://dot.net/v1/dotnet-install.sh | bash /dev/stdin --channel $AWS_LAMBDA_DOTNET_FRAMEWORK_CHANNEL
@@ -11,7 +13,7 @@ phases:
1113
- export PATH="$PATH:$HOME/.dotnet"
1214
- export DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=1
1315
- rm -rf /usr/bin/pwsh
14-
- curl -sSL https://raw.githubusercontent.com/PowerShell/PowerShell/master/docker/InstallTarballPackage.sh | bash /dev/stdin $AWS_LAMBDA_POWERSHELL_VERSION
16+
- dotnet tool install --global PowerShell --version $AWS_LAMBDA_POWERSHELL_VERSION
1517
build:
1618
commands:
1719
- pwsh LambdaRuntimeDockerfiles/Infrastructure/src/Infrastructure/DockerBuild/build.ps1

‎LambdaRuntimeDockerfiles/Infrastructure/src/Infrastructure/Infrastructure.csproj

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
5-
<TargetFramework>netcoreapp3.1</TargetFramework>
5+
<TargetFramework>net8</TargetFramework>
66
<!-- Roll forward to future major versions of the netcoreapp as needed -->
77
<RollForward>Major</RollForward>
88
</PropertyGroup>
99

1010
<ItemGroup>
1111
<!-- CDK Construct Library dependencies -->
12-
<PackageReference Include="Amazon.CDK.Lib" Version="2.44.0" />
12+
<PackageReference Include="Amazon.CDK.Lib" Version="2.165.0" />
1313

1414
<!-- jsii Roslyn analyzers (un-comment to obtain compile-time checks for missing required props
1515
<PackageReference Include="Amazon.Jsii.Analyzers" Version="*" PrivateAssets="all" />

0 commit comments

Comments
 (0)
Please sign in to comment.