-
I have a docker image which uses the latest SDK and lambda/dotnet image and looks something like the following: FROM public.ecr.aws/lambda/dotnet:6 AS base
FROM mcr.microsoft.com/dotnet/sdk:6.0 as build
WORKDIR /src
# copy csproj and restore...
WORKDIR "/src"
# copy sources
FROM build AS publish
ARG BUILD_CONFIG=Release
RUN dotnet publish "MyProject.csproj" \
--configuration $BUILD_CONFIG \
--no-restore \
--runtime linux-x64 \
--self-contained false \
--output /app/publish
FROM base AS final
WORKDIR /var/task
COPY --from=publish /app/publish .
CMD ["MyProject::MyProject.LambdaEntryPoint::FunctionHandlerAsync"] When the container starts and assuming I publish with --self-contained false, I get the following error because the expected runtime is missing from the lambda image.
If I inspect the lambda/dotnet image, I see that it has runtime 6.0.1 and when I inspect the dotnet/sdk image I see that it has runtime 6.0.3. I realize that I could just enable self-contained and it resolves the problem by copying the runtime. I think this effectively the solution proposed by #573. However, this increases the resulting image size by ~100MB and raises a couple questions for me (and perhaps I'm just missing something). Is there a benefit of using lambda/dotnet:6 as a base image if I have to copy the latest runtime using self-contained? The resulting image now has both 6.0.1 and 6.0.3 runtimes and I'm only using the latter. Will there be (future) runtime updates for lambda/dotnet:6 or is the intent that it will always be fixed to 6.0.1? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
@mpetito thanks for point this out. We had some issue with the docker images publishing internally to https://gallery.ecr.aws/lambda/dotnet which resulted in older version of .NET runtime in the image. This has been fixed now and I have verified the image now contains the 6.0.4 runtime which is latest available as of now.
It is recommended to use https://gallery.ecr.aws/lambda/dotnet base image as we regularly patch the images as new .NET runtime updates are available. That said, if you have a use case that requires custom base image, you are free to bring your own. FYI, .NET 6 images are located at https://github.com/aws/aws-lambda-dotnet/tree/master/LambdaRuntimeDockerfiles/Images/net6 |
Beta Was this translation helpful? Give feedback.
@mpetito thanks for point this out. We had some issue with the docker images publishing internally to https://gallery.ecr.aws/lambda/dotnet which resulted in older version of .NET runtime in the image.
This has been fixed now and I have verified the image now contains the 6.0.4 runtime which is latest available as of now.
It is recommended to use https://gallery.ecr.aws/lambda/dotnet base image as we regularly patch the images as…