I am new for dockerize a .Net Core project. I have been working on dockerizing my project, but when I build it, it returns an error.
How can I fix this?
FROM mcr.microsoft.com/dotnet/aspnet:5.0 AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443
FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build
WORKDIR /src
COPY ["ChatCase.Api/ChatCase.Api.csproj", "ChatCase.Api/"]
COPY ["ChatCase.Framework/ChatCase.Framework.csproj", "ChatCase.Framework/"]
COPY ["ChatCase.Business/ChatCase.Business.csproj", "ChatCase.Business/"]
COPY ["ChatCase.Repository/ChatCase.Repository.csproj", "ChatCase.Repository/"]
COPY ["ChatCase.Core/ChatCase.Core.csproj", "ChatCase.Core/"]
COPY ["ChatCase.Common/ChatCase.Common.csproj", "ChatCase.Common/"]
COPY ["ChatCase.Domain/ChatCase.Domain.csproj", "ChatCase.Domain/"]
RUN dotnet restore "ChatCase.Api/ChatCase.Api.csproj"
COPY . .
WORKDIR "/src/ChatCase.Api"
RUN dotnet build "ChatCase.Api.csproj" -c Release -o /app/build
FROM build AS publish
RUN dotnet publish "ChatCase.Api.csproj" -c Release -o /app/publish
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "ChatCase.Api.dll"]
CodePudding user response:
cd C:\Projects\ChatCase
docker build . -f ChatCase.API/Dockerfile -t chatcase