Merge pull request 'Rebuilt pfm-api dockerfile' (#69) from garages3 into main
Reviewed-on: #69
This commit was merged in pull request #69.
This commit is contained in:
@@ -1,21 +1,35 @@
|
|||||||
|
# Stage 1: Runtime base
|
||||||
FROM mcr.microsoft.com/dotnet/aspnet:10.0 AS base
|
FROM mcr.microsoft.com/dotnet/aspnet:10.0 AS base
|
||||||
|
USER app
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
EXPOSE 8080
|
EXPOSE 8080
|
||||||
EXPOSE 8081
|
|
||||||
|
|
||||||
|
# Stage 2: Build & Restore
|
||||||
|
FROM mcr.microsoft.com/dotnet/sdk:10.0 AS build
|
||||||
ARG BUILD_CONFIGURATION=Release
|
ARG BUILD_CONFIGURATION=Release
|
||||||
|
WORKDIR /src
|
||||||
|
|
||||||
|
# Copy csproj files for layer caching
|
||||||
|
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 packages
|
||||||
|
RUN dotnet restore "./PostFundManagement.Api/PostFundManagement.Api.csproj"
|
||||||
|
|
||||||
|
# Copy full source code and build
|
||||||
COPY . .
|
COPY . .
|
||||||
|
WORKDIR "/src/PostFundManagement.Api"
|
||||||
|
RUN dotnet build "./PostFundManagement.Api.csproj" -c $BUILD_CONFIGURATION -o /app/build
|
||||||
|
|
||||||
RUN dotnet restore PostFundManagement.slnx
|
# Stage 3: Publish
|
||||||
|
FROM build AS publish
|
||||||
WORKDIR ./PostFundManagement.Api
|
ARG BUILD_CONFIGURATION=Release
|
||||||
RUN ls -lth
|
RUN dotnet publish "./PostFundManagement.Api.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false
|
||||||
|
|
||||||
RUN dotnet build PostFundManagement.Api.csproj -c $BUILD_CONFIGURATION -o /app/build
|
|
||||||
RUN dotnet publish PostFundManagement.Api.csproj -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false
|
|
||||||
|
|
||||||
|
# Stage 4: Final Runtime
|
||||||
|
FROM base AS final
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY --from=publish /app/publish .
|
COPY --from=publish /app/publish .
|
||||||
ENTRYPOINT ["dotnet", "PostFundManagement.Api.dll"]
|
ENTRYPOINT ["dotnet", "PostFundManagement.Api.dll"]
|
||||||
Reference in New Issue
Block a user