Files
pfm/Dockerfile
T
2026-09-12 12:19:15 +02:00

32 lines
857 B
Docker

FROM mcr.microsoft.com/dotnet/sdk:10.0 AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443
FROM mcr.microsoft.com/dotnet/sdk:10.0 AS build
ARG TARGETARCH
ENV DOTNET_CLI_TELEMETRY_OPTOUT=1 \
NUGET_XMLDOC_MODE=skip
WORKDIR /app_source
# 1. Copy everything over
COPY . .
# 2. Prevent exit code 155 (global.json version mismatch)
RUN rm -f global.json
# 3. Restore all projects using the solution context
RUN dotnet restore "PostFundManagement.slnx"
# 4. Publish directly from the root using the solution context
FROM build AS publish
WORKDIR /app_source
RUN dotnet publish "PostFundManagement.Api/PostFundManagement.Api.csproj" -c Release --no-restore -o /app/publish
# 5. Final runtime assembly
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENV ASPNETCORE_FORWARDEDHEADERS_ENABLED=true
ENTRYPOINT ["dotnet", "PostFundManagement.Api.dll"]