Browse Source

调整

master
杨雷 6 months ago
parent
commit
2c13d0b177
1 changed files with 11 additions and 13 deletions
  1. +11
    -13
      TelpoPush.Worker.ThirdSsl/Dockerfile

+ 11
- 13
TelpoPush.Worker.ThirdSsl/Dockerfile View File

@@ -1,40 +1,38 @@
#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. #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/sdk:8.0-alpine AS base FROM mcr.microsoft.com/dotnet/sdk:8.0-alpine AS base
USER app
WORKDIR /app WORKDIR /app


FROM mcr.microsoft.com/dotnet/sdk:8.0-alpine AS build FROM mcr.microsoft.com/dotnet/sdk:8.0-alpine AS build
ARG BUILD_CONFIGURATION=Release
WORKDIR /src WORKDIR /src
COPY ["TelpoPush.Worker.ThirdSsl/TelpoPush.Worker.ThirdSsl.csproj", "TelpoPush.Worker.ThirdSsl/"] COPY ["TelpoPush.Worker.ThirdSsl/TelpoPush.Worker.ThirdSsl.csproj", "TelpoPush.Worker.ThirdSsl/"]
COPY ["TelpoPush.Common/TelpoPush.Common.csproj", "TelpoPush.Common/"] COPY ["TelpoPush.Common/TelpoPush.Common.csproj", "TelpoPush.Common/"]
COPY ["TelpoPush.Models/TelpoPush.Models.csproj", "TelpoPush.Models/"] COPY ["TelpoPush.Models/TelpoPush.Models.csproj", "TelpoPush.Models/"]
COPY ["TelpoPush.Service/TelpoPush.Service.csproj", "TelpoPush.Service/"] COPY ["TelpoPush.Service/TelpoPush.Service.csproj", "TelpoPush.Service/"]


#RUN dotnet nuget remove source nuget.org
##RUN dotnet nuget add source https://mirrors.cloud.tencent.com/nuget/ -n tencent_nuget # ÌÚѶ
#RUN dotnet nuget add source https://repo.huaweicloud.com/repository/nuget/v3/index.json -n huaweicloud_nuget #»ªÎª

COPY ["nuget.config","."] COPY ["nuget.config","."]
RUN dotnet nuget remove source nuget.org RUN dotnet nuget remove source nuget.org
RUN dotnet nuget add source https://repo.huaweicloud.com/repository/nuget/v3/index.json -n huaweicloud_nuget RUN dotnet nuget add source https://repo.huaweicloud.com/repository/nuget/v3/index.json -n huaweicloud_nuget

RUN dotnet restore "./TelpoPush.Worker.ThirdSsl/TelpoPush.Worker.ThirdSsl.csproj"
RUN dotnet restore "TelpoPush.Worker.ThirdSsl/TelpoPush.Worker.ThirdSsl.csproj"
COPY . . COPY . .
WORKDIR "/src/TelpoPush.Worker.ThirdSsl" WORKDIR "/src/TelpoPush.Worker.ThirdSsl"
RUN dotnet build "./TelpoPush.Worker.ThirdSsl.csproj" -c $BUILD_CONFIGURATION -o /app/build


FROM build AS publish FROM build AS publish
ARG BUILD_CONFIGURATION=Release
RUN dotnet publish "./TelpoPush.Worker.ThirdSsl.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false
RUN dotnet publish "TelpoPush.Worker.ThirdSsl.csproj" -c Release -o /app/publish


FROM base AS final FROM base AS final
WORKDIR /app WORKDIR /app
COPY --from=publish /app/publish . COPY --from=publish /app/publish .
COPY pem/app/pem COPY pem/app/pem


ENV environment=Development ENV environment=Development
ENV TimeZone=Asia/Shanghai ENV TimeZone=Asia/Shanghai
ENV LANG C.UTF-8 ENV LANG C.UTF-8
#RUN ln -snf /usr/share/zoneinfo/$TimeZone /etc/localtime && echo $TimeZone > /etc/timezone

#ENTRYPOINT ["dotnet", "TelpoPush.Worker.ThirdSsl.dll"]
ENTRYPOINT ["sh", "-c", "dotnet TelpoPush.Worker.ThirdSsl.dll --environment=$environment"]
ENV ASPNETCORE_ENVIRONMENT_LOG=Development
RUN ln -snf /usr/share/zoneinfo/$TimeZone /etc/localtime && echo $TimeZone > /etc/timezone
ENTRYPOINT dotnet TelpoPush.Worker.ThirdSsl.dll --environment=$environment

Loading…
Cancel
Save