I am new to docker and trying to create a Dockerfile for ASP.NET Core application. Can someone suggest what changes do I require?
Here is my Dockerfile:
FROM microsoft/dotnet:2.1-sdk
WORKDIR /app
COPY Presentation/ECCP.Web/ *.csproj ./
RUN dotnet restore
COPY . ./
RUN dotnet publish -c Release -o out
FROM microsoft/aspnetcore:2.0
WORKDIR /app
COPY --from=build-env /app/out .
ENTRYPOINT ["dotnet", "api.dll"]
I am facing the following error:
MSBUILD : error MSB1011: Specify which project or solution file to use because this folder contains more than one project or solution file. The command '/bin/sh -c dotnet publish -c Release -o out' returned a non-zero code: 1
It looks like your work dirctory contains both .csproj and .sln files. Try to specify the .sln file in the command. Run
dotnet publish your-solution-file.sln -c Release -o out
I had the same error message with dotnet build and this solves it.
By the way, since .NET Core 2.0 the dotnet restore command is run implicitly, so you may skip it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With