#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.

FROM mcr.microsoft.com/dotnet/aspnet:3.1 AS base
WORKDIR /app

# aptԴðԴֿ debian 10 buster汾
#RUN mv /etc/apt/sources.list /etc/apt/sources.list.bak && \
   #echo "deb http://mirrors.aliyun.com/debian/ buster main non-free contrib" >/etc/apt/sources.list && \
   #echo "deb-src http://mirrors.aliyun.com/debian/ buster main non-free contrib" >>/etc/apt/sources.list && \
   #echo "deb http://mirrors.aliyun.com/debian-security buster/updates main" >>/etc/apt/sources.list && \
   #echo "deb-src http://mirrors.aliyun.com/debian-security buster/updates main" >>/etc/apt/sources.list && \
   #echo "deb http://mirrors.aliyun.com/debian/ buster-updates main non-free contrib" >>/etc/apt/sources.list && \
   #echo "deb-src http://mirrors.aliyun.com/debian/ buster-updates main non-free contrib" >>/etc/apt/sources.list && \
   #echo "deb http://mirrors.aliyun.com/debian/ buster-backports main non-free contrib" >>/etc/apt/sources.list && \
   #echo "deb-src http://mirrors.aliyun.com/debian/ buster-backports main non-free contrib" >>/etc/apt/sources.list

#װapt-get װ libc6-dev , libgdiplus  ֧system.drawing ,Ĭubuntu
#RUN apt-get update -qq && apt-get -y install libgdiplus libc6-dev
#
#EXPOSE 80


RUN echo "deb http://deb.debian.org/debian bullseye main non-free contrib" > /etc/apt/sources.list && \
    echo "deb http://security.debian.org/debian-security bullseye-security main" >> /etc/apt/sources.list && \
    echo "deb http://deb.debian.org/debian bullseye-updates main non-free contrib" >> /etc/apt/sources.list && \
    apt-get update -qq && \
    apt-get -y install libgdiplus libc6-dev

EXPOSE 443

COPY ["src/WMS.Web.Api/wwwroot/WMS.Web.Api.xml", "/app/WMS.Web.Api.xml"]
COPY ["src/WMS.Web.Api/wwwroot/WMS.Web.Core.xml", "/app/WMS.Web.Core.xml"]
COPY ["src/WMS.Web.Api/wwwroot/WMS.Web.Domain.xml", "/app/WMS.Web.Domain.xml"]

FROM mcr.microsoft.com/dotnet/sdk:3.1 AS build
WORKDIR /src
COPY ["src/WMS.Web.Api/WMS.Web.Api.csproj", "src/WMS.Web.Api/"]
COPY ["src/WMS.Web.Repositories/WMS.Web.Repositories.csproj", "src/WMS.Web.Repositories/"]
COPY ["src/WMS.Web.Domain/WMS.Web.Domain.csproj", "src/WMS.Web.Domain/"]
COPY ["src/WMS.Web.Core/WMS.Web.Core.csproj", "src/WMS.Web.Core/"]
RUN dotnet restore "src/WMS.Web.Api/WMS.Web.Api.csproj"
COPY . .
WORKDIR "/src/src/WMS.Web.Api"
RUN dotnet build "WMS.Web.Api.csproj" -c Release -o /app/build

FROM build AS publish
RUN dotnet publish "WMS.Web.Api.csproj" -c Release -o /app/publish

FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "WMS.Web.Api.dll"]