|
- #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/runtime:6.0 AS base
- FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base
- WORKDIR /app
- EXPOSE 16662
-
- FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
- WORKDIR /src
- COPY ["nuget.config","."]
- COPY ["NearCardAttendance.TcpServer/NearCardAttendance.TcpServer.csproj", "NearCardAttendance.TcpServer/"]
- COPY ["NearCardAttendance.Model/NearCardAttendance.Model.csproj", "NearCardAttendance.Model/"]
- COPY ["NearCardAttendance.Common/NearCardAttendance.Common.csproj", "NearCardAttendance.Common/"]
- COPY ["NearCardAttendance.Service/NearCardAttendance.Service.csproj", "NearCardAttendance.Service/"]
- RUN dotnet nuget remove source nuget.org
- #RUN dotnet nuget add source https://repo.huaweicloud.com/repository/nuget/v3/index.json -n huaweicloud_nuget
- RUN dotnet nuget add source https://nuget.cdn.azure.cn/v3/index.json -n azure_nuget
-
- RUN dotnet restore "NearCardAttendance.TcpServer/NearCardAttendance.TcpServer.csproj"
- COPY . .
- WORKDIR "/src/NearCardAttendance.TcpServer"
- RUN dotnet build "NearCardAttendance.TcpServer.csproj" -c Release -o /app/build
-
- FROM build AS publish
- ARG BUILD_CONFIGURATION=Release
- RUN dotnet publish "NearCardAttendance.TcpServer.csproj" -c Release -o /app/publish
-
- FROM base AS final
- WORKDIR /app
- COPY --from=publish /app/publish .
- ENV environment=Development
- ENV TimeZone=Asia/Shanghai
- ENV LANG C.UTF-8
- RUN ln -snf /usr/share/zoneinfo/$TimeZone /etc/localtime && echo $TimeZone > /etc/timezone
-
- #ENTRYPOINT ["dotnet", "NearCardAttendance.TcpServer.dll"]
- ENTRYPOINT ["sh", "-c", "dotnet NearCardAttendance.TcpServer.dll --environment=$environment"]
|