'.Net core API can't read resource File in docker
I have a .net 6 web app where I would like to read a resource file. Nothing complicated, just:
const string consentFileLoc = @"Resources\ConsentBanner.html";
string consentData = string.Empty;
if (System.IO.File.Exists(consentFileLoc))
{
consentData = await System.IO.File.ReadAllTextAsync(consentFileLoc);
}
and this works fine when i deploy to an app service, but when i try to deploy to a dockerized container service it can't find the files. I've investigated the image, and i can see the files, i'm not sure if there are some other permissions i need to be working on for it to work correctly? My dockerfile is just:
FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base
EXPOSE 80
EXPOSE 8081
COPY bin/Release/net6/ App/
RUN chmod -R 755 /App/Resources
WORKDIR /App
ENTRYPOINT ["dotnet", "COBRA5API.dll"]
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
