FROM mcr.microsoft.com/dotnet/sdk:5.0-focal AS build-env
WORKDIR /app
#Copy Source cpde files
COPY . ./
# Restore
RUN dotnet restore --ignore-failed-sources ./src/Cyberlogic.Hermes.WebApi/*proj
# Publish
RUN dotnet publish ./src/Cyberlogic.Hermes.WebApi/*proj -c Release -o ./publish --no-restore
RUN dotnet tool install --global dotnet-gcdump
# Build runtime image
FROM mcr.microsoft.com/dotnet/aspnet:5.0-focal
WORKDIR /app
RUN mkdir -p /root/.dotnet/tools/
COPY --from=build-env /app/publish/ .
COPY --from=build-env /root/.dotnet/tools/ /root/.dotnet/tools/
ENV PATH="/root/.dotnet/tools:${PATH}"
ENV TZ=Europe/Warsaw
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
ENTRYPOINT ["dotnet", "Cyberlogic.Hermes.WebApi.dll", "--no-launch-profile"]
./dotnet-dump collect --process-id 1