# 构建阶段
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS client


#COPY --from=entitieslib:latest /publish /publish/entities
#COPY --from=emaillib:latest /publish /publish/emaillib

WORKDIR /app

# 复制依赖文件 & 恢复
#COPY ./TechHelper.Client.sln ./
COPY ../TechHelper.Client/*.csproj ../TechHelper.Client/

RUN dotnet nuget locals all --clear
RUN dotnet restore "/app/TechHelper.Client/TechHelper.Client.csproj"

# 复制代码 & 发布
COPY . ./
WORKDIR /app/TechHelper.Client
RUN dotnet publish "/app/TechHelper.Client/TechHelper.Client.csproj" -c Release -o /publish

FROM nginx:alpine AS final
RUN rm -rf /usr/share/nginx/html
COPY --from=client /publish/wwwroot /usr/share/nginx/html

EXPOSE 80