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

35 satır
1.6KB

  1. #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.
  2. #FROM mcr.microsoft.com/dotnet/runtime:6.0 AS base
  3. FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base
  4. WORKDIR /app
  5. EXPOSE 16662
  6. FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
  7. WORKDIR /src
  8. COPY ["nuget.config","."]
  9. COPY ["NearCardAttendance.TcpServer/NearCardAttendance.TcpServer.csproj", "NearCardAttendance.TcpServer/"]
  10. COPY ["NearCardAttendance.Model/NearCardAttendance.Model.csproj", "NearCardAttendance.Model/"]
  11. COPY ["NearCardAttendance.Common/NearCardAttendance.Common.csproj", "NearCardAttendance.Common/"]
  12. COPY ["NearCardAttendance.Service/NearCardAttendance.Service.csproj", "NearCardAttendance.Service/"]
  13. RUN dotnet nuget remove source nuget.org
  14. RUN dotnet nuget add source https://repo.huaweicloud.com/repository/nuget/v3/index.json -n huaweicloud_nuget
  15. RUN dotnet restore "NearCardAttendance.TcpServer/NearCardAttendance.TcpServer.csproj"
  16. COPY . .
  17. WORKDIR "/src/NearCardAttendance.TcpServer"
  18. RUN dotnet build "NearCardAttendance.TcpServer.csproj" -c Release -o /app/build
  19. FROM build AS publish
  20. ARG BUILD_CONFIGURATION=Release
  21. RUN dotnet publish "NearCardAttendance.TcpServer.csproj" -c Release -o /app/publish
  22. FROM base AS final
  23. WORKDIR /app
  24. COPY --from=publish /app/publish .
  25. ENV environment=Development
  26. ENV TimeZone=Asia/Shanghai
  27. ENV LANG C.UTF-8
  28. RUN ln -snf /usr/share/zoneinfo/$TimeZone /etc/localtime && echo $TimeZone > /etc/timezone
  29. #ENTRYPOINT ["dotnet", "NearCardAttendance.TcpServer.dll"]
  30. ENTRYPOINT ["sh", "-c", "dotnet NearCardAttendance.TcpServer.dll --environment=$environment"]