Skip to content

Commit

Permalink
[IMP] Added Dockerfile for wkhtmltox v0.12.6-1
Browse files Browse the repository at this point in the history
  • Loading branch information
alexandregaldeano committed Nov 29, 2024
1 parent 9d6a013 commit 6b4fc1e
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 1 deletion.
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ jobs:
tag:
- "0.12.1.3"
- "0.12.5"
- "0.12.6.1"
steps:
- uses: actions/checkout@v2
- name: Set up Docker Buildx
Expand Down
43 changes: 43 additions & 0 deletions Dockerfile-0.12.6.1
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# first stage: build kwkhtmltopdf_server

FROM --platform=linux/amd64 docker.io/golang:1.23.3-bullseye
WORKDIR /tmp
COPY server/kwkhtmltopdf_server.go .
RUN go build kwkhtmltopdf_server.go

# second stage: server with wkhtmltopdf

FROM --platform=linux/amd64 docker.io/ubuntu:22.04

RUN set -x \
&& apt update \
&& apt -y install --no-install-recommends \
wget \
ca-certificates \
fonts-liberation2 \
fontconfig \
libjpeg-turbo8 \
libx11-6 \
libxext6 \
libxrender1 \
xfonts-75dpi \
xfonts-base \
fonts-lato \
&& wget -q -O /tmp/wkhtmltox.deb https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6.1-2/wkhtmltox_0.12.6.1-2.jammy_amd64.deb \
&& echo "800eb1c699d07238fee77bf9df1556964f00ffcf /tmp/wkhtmltox.deb" | sha1sum -c - \
&& dpkg -i /tmp/wkhtmltox.deb \
&& apt -f install \
&& apt -y purge wget --autoremove \
&& apt -y clean \
&& rm -rf /var/lib/apt/lists/* \
&& rm /tmp/wkhtmltox.deb

COPY --from=0 /tmp/kwkhtmltopdf_server /usr/local/bin/

RUN adduser --disabled-password --gecos '' kwkhtmltopdf
USER kwkhtmltopdf
ENV LANG=C.UTF-8
ENV LC_ALL=C.UTF-8

EXPOSE 8080
CMD ["/usr/local/bin/kwkhtmltopdf_server"]
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ There are two clients:
### Run the server

```
$ docker run --rm -p 8080:8080 ghcr.io/acsone/kwkhtmltopdf:0.12.5-latest
$ docker run --rm -p 8080:8080 ghcr.io/acsone/kwkhtmltopdf:0.12.6.1-latest
```

or
Expand All @@ -51,6 +51,12 @@ $ go run server/kwkhtmltopdf_server.go

The server should now listen on http://localhost:8080.

#### Note for Apple Silicon users

The docker image is built for amd64. If you are on Apple Silicon,
you can use it by disabling the `Use Rosetta for x86_64/amd64 emulation on Apple Silicon` option
in the Docker Desktop general settings first.

### Run the client

Any of the following should generate a printout of the wkhtmltopdf home page to /tmp/test.pdf.
Expand Down

0 comments on commit 6b4fc1e

Please sign in to comment.