Surnet / docker-wkhtmltopdf

wkhtmltopdf for multiple base images
https://hub.docker.com/u/surnet/
MIT License
360 stars 65 forks source link

problem with aspnet:6.0-alpine base image #28

Closed stefanodesimone closed 1 year ago

stefanodesimone commented 1 year ago

Hi all, reading Other Images section script I have modified the base image with aspnet:6.0-alpine

FROM surnet/alpine-wkhtmltopdf:3.16.0-0.12.6-full as wkhtmltopdf
FROM  mcr.microsoft.com/dotnet/aspnet:6.0-alpine AS base
WORKDIR /app
EXPOSE 443
# Install dependencies for wkhtmltopdf
RUN apk add --no-cache \
  libstdc++ \
  libx11 \
  libxrender \
  libxext \
  libssl1.1 \
  ca-certificates

# Copy wkhtmltopdf files from docker-wkhtmltopdf image
COPY --from=wkhtmltopdf /bin/wkhtmltopdf /bin/wkhtmltopdf
#COPY --from=wkhtmltopdf /bin/wkhtmltoimage /bin/wkhtmltoimage
#COPY --from=wkhtmltopdf /bin/libwkhtmltox* /bin/
RUN apk update \
    && apk upgrade \
    && apk add --no-cache \
        freetype-dev \
        libpng-dev \
        jpeg-dev \
        libjpeg-turbo \
        libjpeg-turbo-dev
RUN apk add libgdiplus --repository http://dl-3.alpinelinux.org/alpine/edge/testing/
RUN apk add libc-dev libx11-dev
....

when i create the pdf file i receive this error: "Message":"One or more errors occurred.","Data":null,"InnerException":{"ClassName":"System.NotSupportedException","Message":"Unable to load native library. The platform may be missing native dependencies (libjpeg62, etc). Or the current platform is not supported."

Can anyone help me Thx Stefano

chdanielmueller commented 1 year ago

@stefanodesimone Hi Stefano,

Have you tried this solutions?

stefanodesimone commented 1 year ago

Hi, the second solution work but not pass trivy security control. I wrote to HakanL He send me the solution for aspnet:6.0-alpine, that work like a charm [https://github.com/HakanL/WkHtmlToPdf-DotNet/issues/88] the problem was the list of packages to add Thanks a lot Regards Stefano