|
123456789101112131415161718192021222324252627282930313233 |
- #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
- ARG BUILD_CONFIGURATION=Release
- WORKDIR /src
- COPY ["NearCardAttendance.TcpServer/NearCardAttendance.TcpServer.csproj", "NearCardAttendance.TcpServer/"]
- COPY ["NearCardAttendance.Common/NearCardAttendance.Common.csproj", "NearCardAttendance.Common/"]
- COPY ["NearCardAttendance.Service/NearCardAttendance.Service.csproj", "NearCardAttendance.Service/"]
- RUN dotnet restore "./NearCardAttendance.TcpServer/./NearCardAttendance.TcpServer.csproj"
- COPY . .
- WORKDIR "/src/NearCardAttendance.TcpServer"
- RUN dotnet build "./NearCardAttendance.TcpServer.csproj" -c $BUILD_CONFIGURATION -o /app/build
-
- FROM build AS publish
- ARG BUILD_CONFIGURATION=Release
- RUN dotnet publish "./NearCardAttendance.TcpServer.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false
-
- 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"]
|