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.

Dockerfile 1.7KB

9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
12345678910111213141516171819202122232425262728293031323334353637
  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 nuget add source https://nuget.cdn.azure.cn/v3/index.json -n azure_nuget
  16. RUN dotnet restore "NearCardAttendance.TcpServer/NearCardAttendance.TcpServer.csproj"
  17. COPY . .
  18. WORKDIR "/src/NearCardAttendance.TcpServer"
  19. RUN dotnet build "NearCardAttendance.TcpServer.csproj" -c Release -o /app/build
  20. FROM build AS publish
  21. ARG BUILD_CONFIGURATION=Release
  22. RUN dotnet publish "NearCardAttendance.TcpServer.csproj" -c Release -o /app/publish
  23. FROM base AS final
  24. WORKDIR /app
  25. COPY --from=publish /app/publish .
  26. ENV environment=Development
  27. ENV TimeZone=Asia/Shanghai
  28. ENV LANG C.UTF-8
  29. RUN ln -snf /usr/share/zoneinfo/$TimeZone /etc/localtime && echo $TimeZone > /etc/timezone
  30. #ENTRYPOINT ["dotnet", "NearCardAttendance.TcpServer.dll"]
  31. ENTRYPOINT ["sh", "-c", "dotnet NearCardAttendance.TcpServer.dll --environment=$environment"]