Hi, I have created a .NET Core 5.0 website and setup Docker on my Raspberry Pi 4. I have definitely setup Docker correctly because I have spun up a test site using the following command below and confirmed in a browser that it loaded ok.
docker run -it --rm -p 8000:80 --name aspnetcore_sample mcr.microsoft.com/dotnet/samples:aspnetapp
So its down to my project file or docker file being incorrect. Here’s my project file:
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<ApplicationIcon />
<OutputType>Exe</OutputType>
<StartupObject></StartupObject>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="System.Runtime.Caching" Version="6.0.0" />
</ItemGroup>
</Project>
Here’s my Docker file that I run on my Pi:
FROM mcr.microsoft.com/dotnet/sdk:5.0 as builder
ENV DOTNET_CLI_TELEMETRY_OPTOUT 1
RUN mkdir -p /var/ww/Scott/Dan1
WORKDIR /var/ww/Scott
COPY ./FootballData.csproj ./Dan1
WORKDIR /var/ww/Scott/Dan1
RUN dotnet restore ./FootballData.csproj
RUN dotnet publish -c release -o published -r linux-arm --self-contained
FROM mcr.microsoft.com/dotnet/runtime:5.0.13-bullseye-slim-arm32v7
EXPOSE 500
WORKDIR /root/
COPY --from=builder /var/ww/Scott/Dan1/published .
CMD ["dotnet", "./FootballData.dll"]
This is the command that I am running:
sudo docker build -t dangermouse50/footballdata:0.1 .
For this, I receive the following error:
Restored /var/ww/Scott/Dan1/FootballData.csproj (in 29.74 sec).
CSC : error CS5001: Program does not contain a static 'Main' method suitable for an entry point [/var/ww/Scott/Dan1/FootballData.csproj]
I have also tried amending the start up project to the only project in my solution and then I receive this error:
Restored /var/ww/Scott/Dan1/FootballData.csproj (in 31.74 sec).
CSC : error CS1555: Could not find 'FootballData.Program' specified for Main method [/var/ww/Scott/Dan1/FootballData.csproj]
Hopefully this is close to being setup but I can’t complete this last step, it’s killing me. Can somebody please help?