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.9KB

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