Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/surnet/docker-wkhtmltopdf

wkhtmltopdf for multiple base images
https://github.com/surnet/docker-wkhtmltopdf

alpine docker docker-image dockerfile node python wkhtmltoimage wkhtmltopdf wkhtmltox

Last synced: about 23 hours ago
JSON representation

wkhtmltopdf for multiple base images

Awesome Lists containing this project

README

        

# docker-wkhtmltopdf

This repo contains scripts to create docker images which will be available in multiple variants.

The purpose is to publish docker images with a working and patched wkhtmltopdf installation and keep them as small as possible while delivering all functions.

## Naming

The published images follow a naming convention.

### Image name

The image name follows the format:

`surnet/--wkhtmltopdf` or `surnet/-wkhtmltopdf`

- `` matches the underlaying os.
- `` matches the used base image.
- `` matches the used base image if the os and base image are the same.

e.g. `surnet/alpine-node-wkhtmltopdf` or `surnet/alpine-wkhtmltopdf`

### Tags

The tags represent version numbers which follow the format:

`<1>-<2>-<3>`

- `<1>` matches the version of the base image.
- `<2>` matches the wkhtmltopdf version.
- `<3>` matches the Edition (see next chapter).

e.g. `3.12.4-0.12.6-small`

## Editions

There are two editions available for each version.

- `small` contains only wkhtmltopdf. This should be sufficient for most use-cases
- `full` contains wkhtmltopdf, wkhtmltoimage and the libraries.

## Available Images

### surnet/alpine-wkhtmltopdf

[![Docker Stars](https://img.shields.io/docker/stars/surnet/alpine-wkhtmltopdf.svg)](https://hub.docker.com/r/surnet/alpine-wkhtmltopdf/)
[![Docker Pulls](https://img.shields.io/docker/pulls/surnet/alpine-wkhtmltopdf.svg)](https://hub.docker.com/r/surnet/alpine-wkhtmltopdf/)

This image can be used as a base for your project or directly used via bash.

For a list of available versions please see the page on [Docker Hub](https://hub.docker.com/r/surnet/alpine-wkhtmltopdf/tags/) or the [GitHub Container Registry](https://github.com/orgs/Surnet/packages/container/package/alpine-wkhtmltopdf).
If a version you would like is missing please open an issue on this repo.

#### Docker Hub

```yaml
FROM surnet/alpine-wkhtmltopdf:
```

```bash
docker run surnet/alpine-wkhtmltopdf: google.com - > test.pdf
```

#### GitHub Container Registry

```yaml
FROM ghcr.io/surnet/alpine-wkhtmltopdf:
```

```bash
docker run ghcr.io/surnet/alpine-wkhtmltopdf: google.com - > test.pdf
```

### surnet/alpine-node-wkhtmltopdf

[![Docker Stars](https://img.shields.io/docker/stars/surnet/alpine-node-wkhtmltopdf.svg)](https://hub.docker.com/r/surnet/alpine-node-wkhtmltopdf/)
[![Docker Pulls](https://img.shields.io/docker/pulls/surnet/alpine-node-wkhtmltopdf.svg)](https://hub.docker.com/r/surnet/alpine-node-wkhtmltopdf/)

This image can be used as a base for your NodeJS project.

For a list of available versions please see the page on [Docker Hub](https://hub.docker.com/r/surnet/alpine-node-wkhtmltopdf/tags/) or the [GitHub Container Registry](https://github.com/orgs/Surnet/packages/container/package/alpine-node-wkhtmltopdf).
If a version you would like is missing please open an issue on this repo.

#### Docker Hub

```yaml
FROM surnet/alpine-node-wkhtmltopdf:
```

#### GitHub Container Registry

```yaml
FROM ghcr.io/surnet/alpine-node-wkhtmltopdf:
```

### surnet/alpine-python-wkhtmltopdf

[![Docker Stars](https://img.shields.io/docker/stars/surnet/alpine-python-wkhtmltopdf.svg)](https://hub.docker.com/r/surnet/alpine-python-wkhtmltopdf/)
[![Docker Pulls](https://img.shields.io/docker/pulls/surnet/alpine-python-wkhtmltopdf.svg)](https://hub.docker.com/r/surnet/alpine-python-wkhtmltopdf/)

This image can be used as a base for your Python project.

For a list of available versions please see the page on [Docker Hub](https://hub.docker.com/r/surnet/alpine-python-wkhtmltopdf/tags/) or the [GitHub Container Registry](https://github.com/orgs/Surnet/packages/container/package/alpine-python-wkhtmltopdf).
If a version you would like is missing please open an issue on this repo.

#### Docker Hub

```yaml
FROM surnet/alpine-python-wkhtmltopdf:
```

#### GitHub Container Registry

```yaml
FROM ghcr.io/surnet/alpine-python-wkhtmltopdf:
```

## Other Images

If you are using another image based on alpine you can use the following Dockerfile as a starting point.
Just replace the `openjdk:19-jdk-alpine3.16` with the alpine based image you would like to use.
If you do not need wkhtmltoimage or the libs omit the last two lines.
Please check if there is a newer version of `surnet/alpine-wkhtmltopdf` to use than the one described below.

```Dockerfile
FROM surnet/alpine-wkhtmltopdf:3.20.2-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/
```

## Contribute

Please feel free to open a issue or pull request with suggestions.

Keep in mind that the build process of these container takes some (a lot of) time.

## Credits

Based upon the following repos/inputs:
- https://github.com/nodejs/docker-node
- https://github.com/alloylab/Docker-Alpine-wkhtmltopdf
- https://github.com/wkhtmltopdf/wkhtmltopdf/issues/1794
- https://github.com/aantonw/docker-alpine-wkhtmltopdf-patched-qt