Closed Raffaele-Doti closed 4 months ago
Hello!
I send you an example of a working DockerFile below:
FROM mcr.microsoft.com/dotnet/runtime:6.0 AS base
USER app
WORKDIR /app
FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base
RUN apt-get update \
&& apt-get install -y wget \
&& rm -rf /var/lib/apt/lists/*
RUN echo ttf-mscorefonts-installer msttcorefonts/accepted-mscorefonts-eula \
select true | debconf-set-selections
RUN apt-get update \
&& wget http://ftp.fr.debian.org/debian/pool/contrib/m/msttcorefonts/ttf-mscorefonts-installer_3.8_all.deb -P /Downloads \
&& apt-get install -y /Downloads/ttf-mscorefonts-installer_3.8_all.deb \
&& rm /Downloads/ttf-mscorefonts-installer_3.8_all.deb \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
EXPOSE 80
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
ARG BUILD_CONFIGURATION=Release
WORKDIR /src
COPY ["ConsoleApp13/ConsoleApp13.csproj", "ConsoleApp13/"]
RUN dotnet restore "./ConsoleApp13/./ConsoleApp13.csproj"
COPY . .
WORKDIR "/src/ConsoleApp13"
RUN dotnet build "./ConsoleApp13.csproj" -c $BUILD_CONFIGURATION -o /app/build
FROM build AS publish
ARG BUILD_CONFIGURATION=Release
RUN dotnet publish "./ConsoleApp13.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "ConsoleApp13.dll"]
Best regards, Bogdan
Hello!
I send you an example of a working DockerFile below:
FROM mcr.microsoft.com/dotnet/runtime:6.0 AS base USER app WORKDIR /app FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base RUN apt-get update \ && apt-get install -y wget \ && rm -rf /var/lib/apt/lists/* RUN echo ttf-mscorefonts-installer msttcorefonts/accepted-mscorefonts-eula \ select true | debconf-set-selections RUN apt-get update \ && wget http://ftp.fr.debian.org/debian/pool/contrib/m/msttcorefonts/ttf-mscorefonts-installer_3.8_all.deb -P /Downloads \ && apt-get install -y /Downloads/ttf-mscorefonts-installer_3.8_all.deb \ && rm /Downloads/ttf-mscorefonts-installer_3.8_all.deb \ && rm -rf /var/lib/apt/lists/* WORKDIR /app EXPOSE 80 FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build ARG BUILD_CONFIGURATION=Release WORKDIR /src COPY ["ConsoleApp13/ConsoleApp13.csproj", "ConsoleApp13/"] RUN dotnet restore "./ConsoleApp13/./ConsoleApp13.csproj" COPY . . WORKDIR "/src/ConsoleApp13" RUN dotnet build "./ConsoleApp13.csproj" -c $BUILD_CONFIGURATION -o /app/build FROM build AS publish ARG BUILD_CONFIGURATION=Release RUN dotnet publish "./ConsoleApp13.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false FROM base AS final WORKDIR /app COPY --from=publish /app/publish . ENTRYPOINT ["dotnet", "ConsoleApp13.dll"]
Best regards, Bogdan
I tried to integrate your Dockerfile in my solution and it worked ( remind to use System.Configuration.ConfigurationManager version <= 6.0.1 in order to avoid System.Drawing.Common exception ).
You only missed to run the command to install the libgdiplus library so before the font command installation it's mandatory to run this command in the Dockerfile :
RUN apt-get update && apt-get install -y libgdiplus
Thank you, appreciate it.
As suggested in Issue #623 I tried to install fonts in my Docker Image throught Dockerfile. Anyway fonts still continue to be ignored from PDFSimpleExport in FastReport.
P.S. Suggested command
sudo apt-get install ttf-mscorefonts-installer
doesn't work after some Googling I ended up with this :Steps to Reproduce:
Open the FastReport Community Edition desktop designer. Create a new report or open an existing one. Add a text box to the report. Change the font of the text box to a different font (e.g., Comic Sans MS). Save the .frx template to a project folder. Install fonts throught Dockerfile Import the template by code using the Report class. Export the report to PDF using the PDFSimpleExport class. Observe that the exported PDF does not have the font applied as expected. Environment:
FastReport.Export.PdfSimple.PDFSimpleExport version: 2023.2.23 Operating System: Docker Linux Container Expected Behavior: The PDF export should use the font selected in the designer for the text boxes.
Actual Behavior: The PDF export is using a default font, ignoring the font selected in the designer.
Code Snippet: