Question

DigitalOcean App Platform | ASP.NET CORE MVC APP | ERROR: Build Error: Non-Zero Exit

Posted October 17, 2020 77 views
DigitalOcean App Platform

Here my Dockerfile:

FROM mcr.microsoft.com/dotnet/core/sdk:3.1 AS build
WORKDIR /source

COPY mytestapp-Production-MVC.sln .
COPY mytestapp-Production-MVC/mytestapp-Production-MVC.csproj ./mytestapp-Production-MVC
COPY mytestapp-Production-MVC/ ./

# copy everything else and build app
# COPY mytestapp-Production-MVC/. ./source/mytestapp-Production-MVC
WORKDIR /source/mytestapp-Production-MVC
RUN dotnet restore
RUN dotnet publish -c release -o /app --no-restore

# final stage/image
FROM mcr.microsoft.com/dotnet/core/aspnet:3.1
WORKDIR /app
COPY --from=build /app ./
EXPOSE 80
ENTRYPOINT ["dotnet", "mytestapp-Production-MVC.dll"]

I get the following ERROR:

mytestapp-production-mvc-live | 16:44:03 INFO[0032] Running: [/bin/sh -c dotnet restore]  
mytestapp-production-mvc-live | 16:44:46 error building image: error building stage: failed to execute command: starting command: fork/exec /bin/sh: not a directory
auerdev-production-mvc-live | 16:44:46 exit status 1

I hope someone can help.

Greetings,
Sven

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.

×
2 answers

@smauer 👋

This is indeed a strange issue, especially since your Dockerfile looks very similar to our aspdotnet-sample, which is working as expected when I create an app from it.

It’s possible that there is a container layer caching issue happening for your app specifically. If you recreate your app, do you see the same error during build?

@snormoredo Thank you very much. The Dockerfile that you provided works for me.

Submit an Answer