Dockerfile
FROM public.ecr.aws/lambda/dotnet:6 AS base
FROM mcr.microsoft.com/dotnet/sdk:6.0-bullseye-slim as build
WORKDIR /src
COPY ["AWSServerless.csproj", "AWSServerless/"]
RUN dotnet restore "AWSServerless/AWSServerless.csproj"
WORKDIR "/src/AWSServerless"
COPY . .
RUN dotnet build "AWSServerless.csproj" --configuration Release --output /app/build
FROM build AS publish
RUN dotnet publish "AWSServerless.csproj" \
--configuration Release \
--runtime linux-x64 \
--self-contained false \
--output /app/publish \
-p:PublishReadyToRun=true
FROM base AS final
WORKDIR /var/task
CMD ["AWSServerless::AWSServerless.LambdaEntryPoint::FunctionHandlerAsync"]
COPY --from=publish /app/publish .
Project source structure
AWSServerless
Controllers
ValuesController.cs
appsettings.json
Dockerfile
Startup.cs
MyFile.mp4
from the controller I'm trying to access this MyFile.mp4 file
var image = Image.FromFile("/var/task/MyFile.mp4");
but I'm getting
System.IO.FileNotFoundException: /var/task/MyFile.mp4
I have tried with other paths
var image = Image.FromFile("/src/MyFile.mp4");
var image = Image.FromFile("/src/AWSServerless/MyFile.mp4");
None of this work (System.IO.FileNotFoundException
).
What I'm doing wrong here?