29 lines
1.5 KiB
Docker
29 lines
1.5 KiB
Docker
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base
|
|
USER $APP_UID
|
|
WORKDIR /app
|
|
EXPOSE 8081
|
|
|
|
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
|
|
ARG BUILD_CONFIGURATION=Release
|
|
WORKDIR /src
|
|
COPY ["NuGet.Config", "."]
|
|
COPY ["applications/KonSoft.AuthServer/KonSoft.AuthServer.csproj", "applications/KonSoft.AuthServer/"]
|
|
COPY ["shared/KonSoft.Shared.Hosting.Microservices/KonSoft.Shared.Hosting.Microservices.csproj", "shared/KonSoft.Shared.Hosting.Microservices/"]
|
|
COPY ["shared/KonSoft.Shared.Hosting.AspNetCore/KonSoft.Shared.Hosting.AspNetCore.csproj", "shared/KonSoft.Shared.Hosting.AspNetCore/"]
|
|
COPY ["shared/KonSoft.Shared.Hosting/KonSoft.Shared.Hosting.csproj", "shared/KonSoft.Shared.Hosting/"]
|
|
COPY ["shared/KonSoft.Shared.Localization/KonSoft.Shared.Localization.csproj", "shared/KonSoft.Shared.Localization/"]
|
|
RUN dotnet restore "./applications/KonSoft.AuthServer/KonSoft.AuthServer.csproj"
|
|
COPY . .
|
|
WORKDIR "/src/applications/KonSoft.AuthServer"
|
|
RUN dotnet build "./KonSoft.AuthServer.csproj" -c $BUILD_CONFIGURATION -o /app/build
|
|
|
|
# 此阶段用于发布要复制到最终阶段的服务项目
|
|
FROM build AS publish
|
|
ARG BUILD_CONFIGURATION=Release
|
|
RUN dotnet publish "./KonSoft.AuthServer.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false
|
|
|
|
# 此阶段在生产中使用,或在常规模式下从 VS 运行时使用(在不使用调试配置时为默认值)
|
|
FROM base AS final
|
|
WORKDIR /app
|
|
COPY --from=publish /app/publish .
|
|
ENTRYPOINT ["dotnet", "KonSoft.AuthServer.dll"] |