#docker #asp.net-core #dockerfile
Вопрос:
Я новичок в докеризации проекта .Net Core. Я работал над докеризацией своего проекта, но когда я его создаю, он возвращает ошибку.
Как я могу это исправить?
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"]
Ответ №1:
cd C:ProjectsChatCase
docker build . -f ChatCase.API/Dockerfile -t chatcase