Skip to content

Commit

Permalink
fixed dockerfile to install Liberation Sans fonts
Browse files Browse the repository at this point in the history
  • Loading branch information
bezzad committed Jun 11, 2023
1 parent 6a9f2ef commit 8dc68c9
Show file tree
Hide file tree
Showing 14 changed files with 9 additions and 154 deletions.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 8 additions & 12 deletions src/Captcha.Net.Sample/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
#See https://aka.ms/customizecontainer to learn how to customize your debug container and how Visual Studio uses this Dockerfile to build your images for faster debugging.

# FROM docker.mofid.dev/mofidonline/dotnet/aspnet-webapi-libgdplus:6.0
FROM mcr.microsoft.com/dotnet/runtime:6.0 AS base

# Install the fontconfig package
RUN apt-get update; apt-get install -y fontconfig fonts-liberation

# Update the font cache
RUN fc-cache -f -v

WORKDIR /app

FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build

WORKDIR /src
COPY ["Captcha.Net.Sample/Captcha.Net.Sample.csproj", "Captcha.Net.Sample/"]
COPY ["Captcha.Net/Captcha.Net.csproj", "Captcha.Net/"]
Expand All @@ -16,16 +22,6 @@ RUN dotnet build "Captcha.Net.Sample.csproj" -c Release -o /app/build
FROM build AS publish
RUN dotnet publish "Captcha.Net.Sample.csproj" -c Release -o /app/publish /p:UseAppHost=false

# Install the fontconfig package
RUN apt-get update && \
apt-get install -y fontconfig

# Copy the font files into the container
COPY --from=build /app/fonts/*.ttf /usr/share/fonts/truetype/

# Update the font cache
RUN fc-cache -f -v

FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
Expand Down
44 changes: 0 additions & 44 deletions src/Captcha.Net/Captcha.Net.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -22,44 +22,6 @@
<Version>$(FileVersion)</Version>
</PropertyGroup>

<ItemGroup>
<None Remove="fonts\DejaVuSerif-Bold.ttf" />
<None Remove="fonts\DejaVuSerif-BoldItalic.ttf" />
<None Remove="fonts\DejaVuSerif-Italic.ttf" />
<None Remove="fonts\DejaVuSerif.ttf" />
<None Remove="fonts\DejaVuSerifCondensed-Bold.ttf" />
<None Remove="fonts\DejaVuSerifCondensed-BoldItalic.ttf" />
<None Remove="fonts\DejaVuSerifCondensed-Italic.ttf" />
<None Remove="fonts\DejaVuSerifCondensed.ttf" />
</ItemGroup>

<ItemGroup>
<Resource Include="fonts\DejaVuSerif-Bold.ttf">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Resource>
<Resource Include="fonts\DejaVuSerif-BoldItalic.ttf">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Resource>
<Resource Include="fonts\DejaVuSerif-Italic.ttf">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Resource>
<Resource Include="fonts\DejaVuSerif.ttf">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Resource>
<Resource Include="fonts\DejaVuSerifCondensed-Bold.ttf">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Resource>
<Resource Include="fonts\DejaVuSerifCondensed-BoldItalic.ttf">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Resource>
<Resource Include="fonts\DejaVuSerifCondensed-Italic.ttf">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Resource>
<Resource Include="fonts\DejaVuSerifCondensed.ttf">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Resource>
</ItemGroup>

<ItemGroup>
<None Include="..\..\LICENSE">
<Pack>True</Pack>
Expand All @@ -76,10 +38,4 @@
<PackageReference Include="SixLabors.ImageSharp.Drawing" Version="1.0.0-beta15" />
</ItemGroup>

<ItemGroup>
<None Update="fonts\DejaVu Fonts License.txt">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>

</Project>
2 changes: 1 addition & 1 deletion src/Captcha.Net/CaptchaOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public class CaptchaOptions
public CaptchaOptions()
{
if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
FontFamilies = new string[] { "DejaVu Serif", "DejaVu Sans Mono" };
FontFamilies = new string[] { "DejaVu Serif", "DejaVu Sans Mono", "Liberation Sans" };
else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
FontFamilies = new string[] { "San Francisco", "Helvetica" };
else if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
Expand Down
97 changes: 0 additions & 97 deletions src/Captcha.Net/fonts/DejaVu Fonts License.txt

This file was deleted.

Binary file removed src/Captcha.Net/fonts/DejaVuSerif-Bold.ttf
Binary file not shown.
Binary file removed src/Captcha.Net/fonts/DejaVuSerif-BoldItalic.ttf
Binary file not shown.
Binary file removed src/Captcha.Net/fonts/DejaVuSerif-Italic.ttf
Binary file not shown.
Binary file removed src/Captcha.Net/fonts/DejaVuSerif.ttf
Binary file not shown.
Binary file removed src/Captcha.Net/fonts/DejaVuSerifCondensed-Bold.ttf
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed src/Captcha.Net/fonts/DejaVuSerifCondensed.ttf
Binary file not shown.

0 comments on commit 8dc68c9

Please sign in to comment.