You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

29 lines
1.4 KiB
Docker

9 months ago
#See https://aka.ms/customizecontainer to learn how to customize your debug container and how Visual Studio uses this Dockerfile to build your images for faster debugging.
FROM mcr.microsoft.com/dotnet/aspnet:7.0 AS base
RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && echo "Asia/Shanghai" >/etc/timezone
WORKDIR /app
EXPOSE 80
FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build
WORKDIR /src
COPY ["LanSheng/LanShengAPI/LanShengAPI.csproj", "LanSheng/LanShengAPI/"]
COPY ["LanSheng/LanShengService/LanShengService.csproj", "LanSheng/LanShengService/"]
COPY ["Cache/CacheService/CacheService.csproj", "Cache/CacheService/"]
COPY ["CommonExtend/CommonExtend.csproj", "CommonExtend/"]
COPY ["Cache/CacheInterface/CacheInterface.csproj", "Cache/CacheInterface/"]
COPY ["CommonModel/CommonModel.csproj", "CommonModel/"]
COPY ["LanSheng/LanShengInterface/LanShengInterface.csproj", "LanSheng/LanShengInterface/"]
COPY ["LanSheng/LanShengModel/LanShengModel.csproj", "LanSheng/LanShengModel/"]
RUN dotnet restore "LanSheng/LanShengAPI/LanShengAPI.csproj"
COPY . .
WORKDIR "/src/LanSheng/LanShengAPI"
RUN dotnet build "LanShengAPI.csproj" -c Release -o /app/build
FROM build AS publish
RUN dotnet publish "LanShengAPI.csproj" -c Release -o /app/publish /p:UseAppHost=false
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "LanShengAPI.dll"]