Files
security/src/LiteCharmsSecurity.Admin.Api/Dockerfile
T
2026-06-06 00:33:13 +02:00

28 lines
817 B
Docker

FROM mcr.microsoft.com/dotnet/aspnet:10.0 AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443
FROM mcr.microsoft.com/dotnet/sdk:10.0 AS build
ARG TARGETARCH
WORKDIR /app_source
COPY . .
RUN --network=host dotnet restore "LiteCharmsSecurity.sln" --verbosity normal > /tmp/restore_error.log 2>&1 || true
RUN cat /tmp/restore_error.log
RUN if grep -q "error" /tmp/restore_error.log; then exit 1; fi
WORKDIR "/app_source/src/LiteCharmsSecurity.Admin.Api"
RUN dotnet build "LiteCharmsSecurity.Admin.Api.csproj" -c Release -o /app/build
FROM build AS publish
RUN dotnet publish "LiteCharmsSecurity.Admin.Api.csproj" -c Release --no-restore -o /app/publish
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENV ASPNETCORE_FORWARDEDHEADERS_ENABLED=true
ENTRYPOINT ["dotnet", "LiteCharmsSecurity.Admin.Api.dll"]