From 821e2bd87960cd2e9d282d116c1a2b408884822a Mon Sep 17 00:00:00 2001 From: xiaolipro <2357729423@qq.com> Date: Sun, 5 Jan 2025 20:47:36 +0800 Subject: [PATCH] 1 --- docker-compose.yml | 2 ++ global.json | 2 +- src/InterfaceForward.Api/Dockerfile | 20 ++++---------------- 3 files changed, 7 insertions(+), 17 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 4c81b25..6cea6f5 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -4,3 +4,5 @@ build: context: . dockerfile: src/InterfaceForward.Api/Dockerfile + ports: + - "8888:8888" diff --git a/global.json b/global.json index f3365c4..1978c84 100644 --- a/global.json +++ b/global.json @@ -1,5 +1,5 @@ { "sdk": { - "version": "8.0.100" + "version": "8.0.303" } } \ No newline at end of file diff --git a/src/InterfaceForward.Api/Dockerfile b/src/InterfaceForward.Api/Dockerfile index dbd84c0..61d187b 100644 --- a/src/InterfaceForward.Api/Dockerfile +++ b/src/InterfaceForward.Api/Dockerfile @@ -1,21 +1,9 @@ -FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base -USER $APP_UID -WORKDIR /app -EXPOSE 8080 -EXPOSE 8081 - -FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build +FROM mcr.microsoft.com/dotnet/sdk:8.0.303 AS build ARG BUILD_CONFIGURATION=Release WORKDIR /src -COPY ["src/InterfaceForward.Api/InterfaceForward.Api.csproj", "src/InterfaceForward.Api/"] -COPY ["src/InterfaceForward.Application/InterfaceForward.Application.csproj", "src/InterfaceForward.Application/"] -COPY ["src/InterfaceForward.Application.Contracts/InterfaceForward.Application.Contracts.csproj", "src/InterfaceForward.Application.Contracts/"] -COPY ["src/InterfaceForward.Domain.Shared/InterfaceForward.Domain.Shared.csproj", "src/InterfaceForward.Domain.Shared/"] -COPY ["src/InterfaceForward.Repositories/InterfaceForward.Repositories.csproj", "src/InterfaceForward.Repositories/"] -COPY ["src/InterfaceForward.ServiceDefaults/InterfaceForward.ServiceDefaults.csproj", "src/InterfaceForward.ServiceDefaults/"] +COPY . /src RUN dotnet restore "src/InterfaceForward.Api/InterfaceForward.Api.csproj" -COPY . . -WORKDIR "/src/src/InterfaceForward.Api" +WORKDIR "/src/InterfaceForward.Api" RUN dotnet build "InterfaceForward.Api.csproj" -c $BUILD_CONFIGURATION -o /app/build FROM build AS publish @@ -25,4 +13,4 @@ RUN dotnet publish "InterfaceForward.Api.csproj" -c $BUILD_CONFIGURATION -o /app FROM base AS final WORKDIR /app COPY --from=publish /app/publish . -ENTRYPOINT ["dotnet", "InterfaceForward.Api.dll"] +ENTRYPOINT ["dotnet", "InterfaceForward.Api.dll"] \ No newline at end of file