Files
WMS-Api/Dockerfile
2025-07-15 11:56:27 +08:00

52 lines
2.7 KiB
Docker
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#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"]