Surnet / docker-wkhtmltopdf

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

add base image for alpine and golang #53

Closed 9edang closed 1 month ago

9edang commented 1 month ago
chdanielmueller commented 1 month ago

Hi @9edang

There already is a base alpine image. It is called surnet/alpine-wkhtmltopdf. Your requested versions are also already available: 3.20.1-0.12.6-full and 3.20.1-0.12.6-small

If you need a golang image you can do it like that:

FROM surnet/alpine-wkhtmltopdf:3.20.1-0.12.6-full as wkhtmltopdf
FROM golang:1.22.5-alpine3.20

# Install dependencies for wkhtmltopdf
RUN apk add --no-cache \
    libstdc++ \
    libx11 \
    libxrender \
    libxext \
    libssl3 \
    ca-certificates \
    fontconfig \
    freetype \
    ttf-dejavu \
    ttf-droid \
    ttf-freefont \
    ttf-liberation \
    # more fonts
  && apk add --no-cache --virtual .build-deps \
    msttcorefonts-installer \
  # Install microsoft fonts
  && update-ms-fonts \
  && fc-cache -f \
  # Clean up when done
  && rm -rf /tmp/* \
  && apk del .build-deps

# Copy wkhtmltopdf files from docker-wkhtmltopdf image
COPY --from=wkhtmltopdf /bin/wkhtmltopdf /bin/wkhtmltopdf
# COPY --from=wkhtmltopdf /bin/wkhtmltoimage /bin/wkhtmltoimage
# COPY --from=wkhtmltopdf /lib/libwkhtmltox* /lib/