Skip to content

Can't find an example of how to create a dockerfile using the dotnet Lambda Runtime Interface Client #1146

Open
@rhyek

Description

@rhyek

Describe the issue

The page Deploy .NET Lambda functions with container images provides a link to "downloading" the Runtime Interface Client for dotnet, but there are no instructions on how to construct a custom Dockerfile with the client nor is there anything to "download" that I can see.

How can I write a Dockerfile with a custom base and in a straightforward way install or "download" the runtime interface client? The only documentation I have found is about using the Amazon.Lambda.RuntimeSupport as class library which does not seem like something I want to do if I can avoid it, and also it's not clear how that is meant to be used alongside my actual function code (examples don't feel complete).

Btw, I'm trying to write a Dockerfile that like the official public.ecr.aws/lambda/dotnet:6 allows for specifying executable assembles as the Lambda Handler.

I tried hacking together something like this:

FROM mcr.microsoft.com/playwright/dotnet:v1.21.0-focal
ENV LAMBDA_TASK_ROOT=/var/task
COPY --from=public.ecr.aws/lambda/dotnet:6 /var/runtime /var/runtime
COPY --from=build /app/publish/* /var/task
RUN mkdir -p /var/lang/bin
RUN ln -s /usr/bin/dotnet /var/lang/bin/dotnet
ENTRYPOINT [ "/var/runtime/Amazon.Lambda.RuntimeSupport" ]
WORKDIR /var/task
CMD ["HttpApi"] # HttpApi is a .NET 6 Minimal API (Executable Assembly)

but that results in the following error:

2022-04-17T23:11:46.773Z        fail    Amazon.Lambda.RuntimeSupport.ExceptionHandling.LambdaValidationException: Invalid lambda function handler: '/bin/bash'. The valid format is 'ASSEMBLY::TYPE::METHOD'.

Ideally this should all feel as straightforward as it does for python:
The Deploy Python Lambda functions with container images has the section:
image
Which provides a direct link to to a README such as the one in this dotnet repo, and they have a Usage section with clear instructions of how to construct a Dockerfile:

image

Links

https://docs.aws.amazon.com/lambda/latest/dg/csharp-image.html
https://github.com/aws/aws-lambda-dotnet/blob/master/README.md

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions