Skip to content

Commit 8c808d6

Browse files
committed
Updated Code changes
1 parent df21083 commit 8c808d6

File tree

1 file changed

+15
-102
lines changed

1 file changed

+15
-102
lines changed

Document-Processing/PDF/Conversions/HTML-To-PDF/NET/troubleshooting.md

Lines changed: 15 additions & 102 deletions
Original file line numberDiff line numberDiff line change
@@ -1570,114 +1570,27 @@ Refer to the following package reference:
15701570
{% endhighlight %}
15711571
{% endtabs %}
15721572

1573-
## Installing Chromium on Alpine without using edge to avoid Twistlock/Prisma security alerts
1573+
## Installing Chromium in Alpine Linux Docker Without Edge Repository
15741574

15751575
<table>
1576-
<th style="font-size:14px" width="100px">Issue</th>
1577-
<th style="font-size:14px">
1578-
Chromium is installed from the Alpine edge/community repository using:
1579-
<br/>
1580-
<code>apk add chromium --update-cache --repository http://nl.alpinelinux.org/alpine/edge/community</code>
1581-
<br/>
1582-
This enables HTML-to-PDF conversion but triggers Twistlock/Prisma Cloud security alerts due to packages pulled from the edge repository.
1576+
<th style="font-size:14px" width="100px">Reason
1577+
</th>
1578+
<th style="font-size:14px">Using the Alpine Edge repository introduces packages that are not part of the stable release, which can trigger Twist lock security issues. To maintain security compliance, we should install Chromium from the stable repository.
15831579
</th>
1584-
<tr>
1585-
<th style="font-size:14px" width="100px">Reason</th>
1586-
<td>
1587-
The <b>edge</b> repository is rolling/testing and can introduce newer dependencies and CVEs flagged by enterprise scanners. Using edge also reduces build reproducibility across environments.
1588-
</td>
1589-
</tr>
1590-
<tr>
1591-
<th style="font-size:14px" width="100px">Solution</th>
1592-
<td>
1593-
Install Chromium from the <b>stable Alpine repositories</b> (main/community) and include required runtime dependencies. This avoids the edge repo entirely and reduces security findings.
1594-
<br/><br/>
1595-
Use the following Dockerfile as a reference:
1596-
<br/><br/>
15971580

1581+
<tr>
1582+
<th style="font-size:14px" width="100px">Solution
1583+
</th>
1584+
<td>You can install Chromium directly from the stable Alpine repository using the following command:
1585+
<br><br>
1586+
<b>Docker File:</b><br><br>
15981587
{% tabs %}
1599-
{% highlight C# tabtitle="Dockerfile (Alpine, stable repos)" %}
1600-
1601-
FROM mcr.microsoft.com/dotnet/aspnet:8.0-alpine AS base
1602-
1603-
RUN apk upgrade -U && \
1604-
apk add --no-cache tzdata && \
1605-
apk add --no-cache icu-libs && \
1606-
apk update && \
1607-
apk upgrade && \
1608-
apk add --no-cache openssl && \
1609-
apk update && \
1610-
apk upgrade --available && \
1611-
apk add --update ca-certificates && \
1612-
apk add --no-cache chromium && \
1613-
rm -rf /var/cache/apk/* && \
1614-
apk update && \
1615-
apk upgrade && \
1616-
apk add --no-cache \
1617-
libgdiplus fontconfig freetype ttf-dejavu libjpeg-turbo libpng mpg123 libopenmpt alsa-lib cairo cups-libs dbus-libs \
1618-
expat gdk-pixbuf glib gtk+3.0 nspr nss pango libstdc++ \
1619-
libx11 libxcomposite libxcursor libxdamage \
1620-
libxext libxfixes libxi libxrandr libxrender libxtst \
1621-
mesa-gl mesa-dri-gallium && \
1622-
rm -rf /var/cache/apk/*
1623-
1624-
RUN mkdir -p /crashpad && \
1625-
chown -R root:root /crashpad
1626-
1627-
ENV XDG_CONFIG_HOME=/tmp/.chromium
1628-
ENV XDG_CACHE_HOME=/tmp/.chromium
1629-
ENV CHROME_CRASHPAD_DATABASE=/crashpad
1630-
ENV DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=false
1631-
1632-
RUN mkdir -p /var/www/.config/google-chrome/Crashpad
1633-
1634-
WORKDIR /app
1635-
EXPOSE 8080
1636-
1637-
FROM mcr.microsoft.com/dotnet/sdk:8.0-alpine AS build
1638-
ARG BUILD_CONFIGURATION=Release
1639-
WORKDIR /src
1640-
1641-
COPY ["Directory.Build.targets", "."]
1642-
COPY ["NuGet.config", "."]
1643-
COPY ["production/Ops.PDFConversionAPI.Web/Ops.PDFConversionAPI.Web.csproj", "production/Ops.PDFConversionAPI.Web/"]
1644-
1645-
RUN dotnet restore "./production/Ops.PDFConversionAPI.Web/Ops.PDFConversionAPI.Web.csproj"
1646-
1647-
COPY . .
1648-
1649-
WORKDIR "/src/production/Ops.PDFConversionAPI.Web"
1650-
RUN dotnet build "./Ops.PDFConversionAPI.Web.csproj" -c $BUILD_CONFIGURATION -o /app/build
1651-
1652-
FROM build AS publish
1653-
ARG BUILD_CONFIGURATION=Release
1654-
RUN dotnet publish "./Ops.PDFConversionAPI.Web.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false
1655-
1656-
FROM base AS final
1657-
WORKDIR /app
1658-
COPY --from=publish /app/publish .
1588+
{% highlight C# tabtitle="C#" %}
1589+
RUN apk add --no-cache chromium && \
1590+
rm -rf /var/cache/apk/*
16591591

1660-
ENTRYPOINT ["dotnet", "Ops.PDFConversionAPI.Web.dll"]
16611592
{% endhighlight %}
16621593
{% endtabs %}
1663-
1664-
<b>Notes</b>:
1665-
- No edge repository is referenced; Chromium comes from stable Alpine repos.
1666-
- Typical Chromium paths on Alpine:
1667-
- <code>/usr/bin/chromium-browser</code> (symlink) or
1668-
- <code>/usr/lib/chromium/chromium</code>
1669-
Set this path in your converter settings:
1670-
{% tabs %}
1671-
{% highlight C# tabtitle="C# (BlinkPath)" %}
1672-
var settings = new BlinkConverterSettings();
1673-
settings.BlinkPath = "/usr/bin/chromium-browser"; // or "/usr/lib/chromium/chromium"
1674-
settings.CommandLineArguments.Add("--no-sandbox");
1675-
settings.CommandLineArguments.Add("--disable-setuid-sandbox");
1676-
settings.CommandLineArguments.Add("--disable-dev-shm-usage");
1677-
{% endhighlight %}
1678-
{% endtabs %}
1679-
1680-
We have attached the modified docker file for your reference <a href="https://www.syncfusion.com/downloads/support/directtrac/general/ze/Dockerfile">Docker file</a>.
1681-
16821594
</td>
1683-
</tr>
1595+
</tr>
1596+
</table>

0 commit comments

Comments
 (0)