'How to copy custom JSON file into docker container?

I added custom json file in my .net core web API project and retrieved data from that json file successfully when running it in debug mode. But, problem arise when I run it as a docker container.

Error says "Missing custom.json file in '/app/' folder".



Solution 1:[1]

Please modify your .csproj file like below to include your custom.json file.

<ItemGroup>
    <ResolvedFileToPublish Include="azure-functions-host/appsettings.prod.json">
    <RelativePath>azure-functions-host/appsettings.prod.json</RelativePath>
    </ResolvedFileToPublish>
</ItemGroup>

For more details, you can refer below post.

ASP.NET Core: Exclude or include files on publish

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Jason