FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443
ENV LANG="zh_CN.UTF-8"
ENV LANGUAGE="zh_CN:zh"
ENV TZ=Asia/Shanghai
ENV DEBIAN_FRONTEND noninteractive
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
WORKDIR /src
COPY ["Dp.ArgCourse/Ya.ArgCourse.csproj", "Dp.ArgCourse/"]
COPY ["Dp.ArgCommon/DP.ArgComm.csproj", "Dp.ArgCommon/"]
COPY ["Dp.ArgRes/Dp.ArgRes.csproj", "Dp.ArgRes/"]
COPY ["Dp.ArgService/Dp.ArgService.csproj", "Dp.ArgService/"]
COPY ["Dp.ClsrRepos/Dp.ClsrRepos.csproj", "Dp.ClsrRepos/"]
RUN dotnet restore "Dp.ArgCourse/Ya.ArgCourse.csproj"
COPY . .
WORKDIR "/src/Dp.ArgCourse"
RUN dotnet build "Ya.ArgCourse.csproj" -c Release -o /app/build
FROM build AS publish
RUN dotnet publish "Ya.ArgCourse.csproj" -c Release -o /app/publish
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "Ya.ArgCourse.dll"]
本地发布项目,然后简化一下dockerfile放到发布后的文件夹里,重新build一下,试试
FROM mcr.microsoft.com/dotnet/aspnet:6.0
WORKDIR /app
COPY . .
ENTRYPOINT ["dotnet", "Ya.ArgCourse.dll"]