From 2a8d72963ddca40f55295396c51f2da7948a7dcb Mon Sep 17 00:00:00 2001 From: Hermes Agent Date: Sun, 13 Sep 2026 18:07:32 +0200 Subject: [PATCH] Moved api dockerfile to project folder --- Dockerfile | 36 ------------------------------- PostFundManagement.Api/Dockerfile | 33 ++++++++++++++++++++++++++++ docker-compose.yml | 2 +- 3 files changed, 34 insertions(+), 37 deletions(-) delete mode 100644 Dockerfile create mode 100644 PostFundManagement.Api/Dockerfile diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index f97cede..0000000 --- a/Dockerfile +++ /dev/null @@ -1,36 +0,0 @@ -# Base image for running the app -FROM mcr.microsoft.com/dotnet/aspnet:10.0 AS base -WORKDIR /app -EXPOSE 8080 -EXPOSE 8081 - -# Build stage -FROM mcr.microsoft.com/dotnet/sdk:10.0 AS build -ARG BUILD_CONFIGURATION=Release -WORKDIR /src - -# Copy project files for dependency restoration -COPY ["PostFundManagement.Api/PostFundManagement.Api.csproj", "PostFundManagement.Api/"] -COPY ["PostFundManagement.Application/PostFundManagement.Application.csproj", "PostFundManagement.Application/"] -COPY ["PostFundManagement.Domain/PostFundManagement.Domain.csproj", "PostFundManagement.Domain/"] -COPY ["PostFundManagement.Infrastructure/PostFundManagement.Infrastructure.csproj", "PostFundManagement.Infrastructure/"] - -# Restore dependencies -RUN dotnet restore "PostFundManagement.Api/PostFundManagement.Api.csproj" - -# Copy the remaining source code -COPY . . - -# Build the API project directly from /src context -RUN dotnet build "PostFundManagement.Api/PostFundManagement.Api.csproj" -c $BUILD_CONFIGURATION -o /app/build - -# Publish stage -FROM build AS publish -ARG BUILD_CONFIGURATION=Release -RUN dotnet publish "PostFundManagement.Api/PostFundManagement.Api.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false - -# Final runtime stage -FROM base AS final -WORKDIR /app -COPY --from=publish /app/publish . -ENTRYPOINT ["dotnet", "PostFundManagement.Api.dll"] \ No newline at end of file diff --git a/PostFundManagement.Api/Dockerfile b/PostFundManagement.Api/Dockerfile new file mode 100644 index 0000000..bf5bd23 --- /dev/null +++ b/PostFundManagement.Api/Dockerfile @@ -0,0 +1,33 @@ +# Base image for running the app +FROM mcr.microsoft.com/dotnet/aspnet:10.0 AS base +WORKDIR /app +EXPOSE 8080 +EXPOSE 8081 + +# Build stage +FROM mcr.microsoft.com/dotnet/sdk:10.0 AS build +ARG BUILD_CONFIGURATION=Release +WORKDIR /src + +# Copy project file from the current directory context +COPY ["PostFundManagement.Api.csproj", "./"] + +# Restore dependencies +RUN dotnet restore "PostFundManagement.Api.csproj" + +# Copy the remaining source code in PostFundManagement.Api +COPY . . + +# Build the API project +RUN dotnet build "PostFundManagement.Api.csproj" -c $BUILD_CONFIGURATION -o /app/build + +# Publish stage +FROM build AS publish +ARG BUILD_CONFIGURATION=Release +RUN dotnet publish "PostFundManagement.Api.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false + +# Final runtime stage +FROM base AS final +WORKDIR /app +COPY --from=publish /app/publish . +ENTRYPOINT ["dotnet", "PostFundManagement.Api.dll"] \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index 27dd216..a192a47 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -3,7 +3,7 @@ services: image: pfm-api build: context: . - dockerfile: Dockerfile + dockerfile: PostFundManagement.Api/Dockerfile network: host container_name: pfm-api ports: