I have a requirement to use lambda function with some custom base image. So I have written following docker file. This generates image successfully but not using the custom base image. I can confirm by printing some of the environment variable used in it.
Can someone suggests what’s wrong in this?
I tried printing ENV variables after deploying image on Lambda function.
FROM public.ecr.aws/lambda/dotnet:6 AS base
FROM mcr.microsoft.com/dotnet/sdk:6.0 as build
WORKDIR /src
COPY ["MyProject.ConverterLambda/MyProject.ConverterLambda.csproj", "ConverterLambda/"]
WORKDIR "/src/ConverterLambda"
COPY . .
RUN ls -laR
RUN dotnet restore "MyProject.ConverterLambda.csproj" --configfile nuget.config
RUN dotnet build "MyProject.ConverterLambda.csproj" --configuration Release --output /app/build --configfile nuget.config
FROM build AS publish
RUN dotnet publish "MyProject.ConverterLambda.csproj" --configuration Release --runtime linux-x64 --self-contained false --output /app/publish -p:PublishReadyToRun=true
# this is a custom base image and should use over a lambda created.
FROM 123456.dkr.ecr.us-east-1.amazonaws.com/myapp/dev/mytag:some-base-rhel-image-1447521 as ppln
FROM mcr.microsoft.com/dotnet/runtime:6.0 AS runtime
COPY --from=ppln /Repo/configuration /Repo/configuration
ENV Repo_CONFIGURATION "/Repo/configuration/configUrl.dev.xml"
#Hermes libs (with kafka native libraries)
COPY --from=ppln /hermes/lib/netstandard2.0 /hermes/lib/netstandard2.0
ENV HERMES_ROOT "/hermes/lib/netstandard2.0"
FROM base AS final
WORKDIR /var/task
COPY --from=publish /app/publish .
CMD ["MyProject.ConverterLambda::MyProject.ConverterLambda.Function::FunctionHandler]