I followed the tutorial at: https://github.com/creativefisher/aspnetcoresample, and I was able to get it running after changing the Dockerfile to have the most recent .Net versions. It can be seen running here: https://octopus-app-ykoiy.ondigitalocean.app/
Once that was done, I decided to create a totally new project using Visual Studio 2022, .Net 7 Web Api, just the generic shell component with Docker support. It runs fine locally.
When I try to deploy this one however, it builds but fails the deploy stage.
The only output for the Deploy Log is:
[2023-06-20 17:30:15] info: Microsoft.Hosting.Lifetime [2023-06-20 17:30:15] Now listening on: http://[::]:80 [2023-06-20 17:30:15] info: Microsoft.Hosting.Lifetime [2023-06-20 17:30:15] Application started. Press Ctrl+C to shut down. [2023-06-20 17:30:15] info: Microsoft.Hosting.Lifetime [2023-06-20 17:30:15] Hosting environment: Production [2023-06-20 17:30:15] info: Microsoft.Hosting.Lifetime [2023-06-20 17:30:15] Content root path: /app 
Digital Ocean merely states “<project> failed to deploy.”
I am a Dockerfile neophyte and not sure how to solve this. The interesting thing is that when I run the code local, using docker, the messages above are exactly what the docker image has in it while it is running, as it that seems to be it’s natural “running” state.
The docker file is here, it was auto generated by Visual Studio, but it looks more or less like the version from the tutorial, save the project names are different.
#See https://aka.ms/customizecontainer to learn how to customize your debug container and how Visual Studio uses this Dockerfile to build your images for faster debugging. FROM mcr.microsoft.com/dotnet/aspnet:7.0 AS base WORKDIR /app EXPOSE 80 EXPOSE 443 FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build WORKDIR /src COPY ["project-luna-api-net.csproj", "."] RUN dotnet restore "./project-luna-api-net.csproj" COPY . . WORKDIR "/src/." RUN dotnet build "project-luna-api-net.csproj" -c Release -o /app/build FROM build AS publish RUN dotnet publish "project-luna-api-net.csproj" -c Release -o /app/publish /p:UseAppHost=false FROM base AS final WORKDIR /app COPY --from=publish /app/publish . ENTRYPOINT ["dotnet", "project-luna-api-net.dll"]
Any ideas? I would much prefer to be using .Net API as opposed to expressjs api!
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.