Docker dotnet publish output not found

1.1k views Asked by At

I am trying to successfully build/publish a project using a dockerfile. However, for some reason it cannot find the output folder that it should of created. From the other posts, everything looks correct in my docker file.

Dockerfile

FROM mcr.microsoft.com/dotnet/sdk:5.0 as build
WORKDIR /app
COPY . .

RUN dotnet restore
RUN dotnet publish ./ClassLibrary2.csproj -c Release -o out

# Build runtime image
FROM mcr.microsoft.com/dotnet/aspnet:5.0
WORKDIR /app
COPY --from=build /app/out .
ENTRYPOINT ["dotnet", "ClassLibrary2.dll"]

Directory

enter image description here

Docker Command(ran from the folder where the docker file lies): docker build -f Dockerfile-SignedAssembly -t signed-assembly . Output:

enter image description here

Updated Image with missing bat file enter image description here

1

There are 1 answers

0
xfusion On

just replace COPY --from=build /app/out . by COPY --from=build /out . as shown below

FROM mcr.microsoft.com/dotnet/sdk:5.0 as build
WORKDIR /app
COPY . .

RUN dotnet restore
RUN dotnet publish ./ClassLibrary2.csproj -c Release -o /out

# Build runtime image
FROM mcr.microsoft.com/dotnet/aspnet:5.0
WORKDIR /app
COPY --from=build /out .
ENTRYPOINT ["dotnet", "ClassLibrary2.dll"]