Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

33 lines
1.5KB

  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. ARG BUILD_CONFIGURATION=Release
  8. WORKDIR /src
  9. COPY ["NearCardAttendance.TcpServer/NearCardAttendance.TcpServer.csproj", "NearCardAttendance.TcpServer/"]
  10. COPY ["NearCardAttendance.Common/NearCardAttendance.Common.csproj", "NearCardAttendance.Common/"]
  11. COPY ["NearCardAttendance.Service/NearCardAttendance.Service.csproj", "NearCardAttendance.Service/"]
  12. RUN dotnet restore "./NearCardAttendance.TcpServer/./NearCardAttendance.TcpServer.csproj"
  13. COPY . .
  14. WORKDIR "/src/NearCardAttendance.TcpServer"
  15. RUN dotnet build "./NearCardAttendance.TcpServer.csproj" -c $BUILD_CONFIGURATION -o /app/build
  16. FROM build AS publish
  17. ARG BUILD_CONFIGURATION=Release
  18. RUN dotnet publish "./NearCardAttendance.TcpServer.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false
  19. FROM base AS final
  20. WORKDIR /app
  21. COPY --from=publish /app/publish .
  22. ENV environment=Development
  23. ENV TimeZone=Asia/Shanghai
  24. ENV LANG C.UTF-8
  25. RUN ln -snf /usr/share/zoneinfo/$TimeZone /etc/localtime && echo $TimeZone > /etc/timezone
  26. #ENTRYPOINT ["dotnet", "NearCardAttendance.TcpServer.dll"]
  27. ENTRYPOINT ["sh", "-c", "dotnet NearCardAttendance.TcpServer.dll --environment=$environment"]