37 lines
1.8 KiB
Docker
37 lines
1.8 KiB
Docker
# 构建上下文 = 仓库根目录(含 NuGet.Config / Directory.Build.props / src/)
|
||
# Kaniko 默认: --build-arg=NUGET_IDESHIP=http://baget/v3/index.json
|
||
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
|
||
WORKDIR /src
|
||
|
||
ARG NUGET_IDESHIP=http://baget/v3/index.json
|
||
|
||
COPY ["NuGet.Config", "Directory.Build.props", "./"]
|
||
# 集群内构建走 Service;本机构建可 --build-arg=NUGET_IDESHIP=https://baget.ideship.com/v3/index.json
|
||
RUN sed -i \
|
||
-e "s|https://baget.ideship.com/v3/index.json|${NUGET_IDESHIP}|g" \
|
||
-e "s|http://baget.ideship.com/v3/index.json|${NUGET_IDESHIP}|g" \
|
||
NuGet.Config \
|
||
&& cat NuGet.Config
|
||
|
||
COPY ["src/InterfaceForward.Domain.Shared/InterfaceForward.Domain.Shared.csproj", "src/InterfaceForward.Domain.Shared/"]
|
||
COPY ["src/InterfaceForward.Application.Contracts/InterfaceForward.Application.Contracts.csproj", "src/InterfaceForward.Application.Contracts/"]
|
||
COPY ["src/InterfaceForward.Repositories/InterfaceForward.Repositories.csproj", "src/InterfaceForward.Repositories/"]
|
||
COPY ["src/InterfaceForward.Application/InterfaceForward.Application.csproj", "src/InterfaceForward.Application/"]
|
||
COPY ["src/InterfaceForward.Api/InterfaceForward.Api.csproj", "src/InterfaceForward.Api/"]
|
||
|
||
RUN dotnet restore "src/InterfaceForward.Api/InterfaceForward.Api.csproj"
|
||
|
||
COPY . .
|
||
WORKDIR /src/src/InterfaceForward.Api
|
||
ARG BUILD_CONFIGURATION=Release
|
||
RUN dotnet build "InterfaceForward.Api.csproj" -c $BUILD_CONFIGURATION -o /app/build --no-restore
|
||
|
||
FROM build AS publish
|
||
ARG BUILD_CONFIGURATION=Release
|
||
RUN dotnet publish "InterfaceForward.Api.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false --no-restore
|
||
|
||
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS runtime
|
||
WORKDIR /app
|
||
COPY --from=publish /app/publish .
|
||
ENTRYPOINT ["dotnet", "InterfaceForward.Api.dll"]
|