Skip to content

Instantly share code, notes, and snippets.

@FabianoCampos
Created November 24, 2021 20:16
Show Gist options
  • Save FabianoCampos/67b1a485ae5ea4538c68367b65f8af39 to your computer and use it in GitHub Desktop.
Save FabianoCampos/67b1a485ae5ea4538c68367b65f8af39 to your computer and use it in GitHub Desktop.
Dockerfile para C# com instalação de fonts
FROM mcr.microsoft.com/dotnet/core/aspnet:3.1 AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443
#resolve problema de biblioteca responsavel por listar as fonts instaladas
RUN apt-get update
RUN apt-get install -y apt-utils
RUN apt-get install -y libgdiplus
RUN apt-get install -y libc6-dev
RUN ln -s /usr/lib/libgdiplus.so/usr/lib/gdiplus.dll
#Instalação das google fonts
RUN apt-get install -y wget
RUN apt-get install -y fontconfig
RUN wget https://github.com/google/fonts/archive/main.tar.gz -O gf.tar.gz
RUN tar -xf gf.tar.gz
RUN mkdir -p /usr/share/fonts/truetype/google-fonts
RUN find $PWD/fonts-main/ -name "*.ttf" -exec install -m644 {} /usr/share/fonts/truetype/google-fonts/ \; || return 1
RUN rm -f gf.tar.gz
RUN fc-cache -f && rm -rf /var/cache/*
FROM mcr.microsoft.com/dotnet/core/sdk:3.1 AS build
ENV ASPNETCORE_URLS=http://*:80
ENV ASPNETCORE_ENVIRONMENT="Development"
WORKDIR /src
COPY [".", ""]
#para resolver problemas de conexão em feeds nugets privados
COPY ["NuGet.Config", "/"]
RUN ["cp", "NuGet.Config", "/root/.nuget/NuGet/NuGet.Config"]
RUN dotnet restore "src/MeuProjeto.WebApi/MeuProjeto.WebApi.csproj"
WORKDIR "src/MeuProjeto.WebApi"
RUN dotnet build "MeuProjeto.WebApi.csproj" -c Release -o /app/build
FROM build AS publish
RUN dotnet publish "MeuProjeto.WebApi.csproj" -c Release -o /app/publish
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "MeuProjeto.WebApi.dll"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment