Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Work in progress rebase #16

Open
wants to merge 29 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
95f9f49
Fix wkhtmltopdf package download URL
yann-soubeyrand Apr 7, 2022
96ed4cf
Use fully qualified Docker image name
yann-soubeyrand Apr 6, 2022
9019c8f
Remove temporary wkhtmltopdf package from Docker image
yann-soubeyrand Apr 6, 2022
e666028
Merge pull request #12 from camptocamp/rm-tmp-pkg
sbidoul Apr 10, 2022
8ebe6a8
Build with GitHub actions to ghcr.io
sbidoul Apr 10, 2022
89cb0b1
ci: fix Dockerfile reference
sbidoul Apr 10, 2022
2476841
Update README
sbidoul Apr 10, 2022
f0ca6e0
Test with GitHub actions
sbidoul Apr 10, 2022
7e85645
Update expected test results for 0.12.1.3
sbidoul Apr 10, 2022
30399b4
Merge pull request #14 from acsone/test-with-gha
sbidoul Apr 10, 2022
ac98d2c
feat: add build auto on release
vrenaville Mar 11, 2022
54a536b
fix: build issue
vrenaville Jun 14, 2022
b3e22ba
fix: travis merge
vrenaville Jun 14, 2022
b1e9638
feat: improve logging
vrenaville Jun 16, 2022
fa5b3c9
feat: add running command log
vrenaville Jun 16, 2022
7633314
feat: bump version to buster package
vrenaville Jun 16, 2022
a84bc07
feat: return to ubuntu 18.04
vrenaville Jun 16, 2022
5919712
feat: revert to debian
vrenaville Jun 16, 2022
b214404
fix:log
vrenaville Jun 20, 2022
bbedb68
fix: do not hang on on dns resolve error
vrenaville Jun 20, 2022
3dbb9ae
fix: fix debian version
vrenaville Jun 21, 2022
86eeac6
feat: use xserver for rendering
vrenaville Jun 22, 2022
4b95d4e
fix: do not hang on on dns resolve error
vrenaville Jun 20, 2022
afaa98c
fix: print with file
vrenaville Jun 21, 2022
4c06674
Revert "feat: use xserver for rendering"
vrenaville Jun 22, 2022
4a5b460
feat: switch to json log + fix too ealy closing file
vrenaville Jul 6, 2022
8e21525
fix: command wait misplacing
vrenaville Jul 6, 2022
6782437
feat: limit logs
vrenaville Jul 6, 2022
797f988
feat: remove unuseful log
vrenaville Jul 7, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: CI

on:
push:
branches:
- master

jobs:
build-image:
runs-on: ubuntu-latest
strategy:
matrix:
tag:
- "0.12.1.3"
- "0.12.5"
steps:
- uses: actions/checkout@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to ghcr.io
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build image
uses: docker/build-push-action@v2
with:
tags: |
ghcr.io/${{ github.repository }}:${{ matrix.tag }}-latest
labels: |
org.opencontainers.image.source=${{ github.event.repository.html_url }}
file: Dockerfile-${{ matrix.tag }}
cache-from: type=registry,ref=ghcr.io/${{ github.repository }}:${{ matrix.tag }}-latest
cache-to: type=inline
push: true
34 changes: 34 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Test

on:
push:
branches:
- master
pull_request:

jobs:
test:
runs-on: ubuntu-18.04
strategy:
matrix:
WKHTMLTOPDF_VERSION:
- "0.12.1.3"
- "0.12.5"
steps:
- uses: actions/checkout@v2
- name: Install dependencies
run: |
pip install tox
sudo apt-get -y install -f ghostscript python-requests
# overwrite default imagemagick policy that prevents reading PDF
sudo cp tests/travis-imagemagick-policy.xml /etc/ImageMagick-6/policy.xml
- name: Install kwkhtmltopdf for local tests
run: |
wget -q -O wkhtmltox.deb https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox_0.12.5-1.bionic_amd64.deb
sudo apt -y install -f ./wkhtmltox.deb
- name: Build and start server image
run: |
docker build -f Dockerfile-${{ matrix.WKHTMLTOPDF_VERSION }} -t kwkhtmltopdf:${{ matrix.WKHTMLTOPDF_VERSION }} .
docker run -d --name kwkhtmltopdf -p 8080:8080 kwkhtmltopdf:${{ matrix.WKHTMLTOPDF_VERSION }}
- name: Run tests
run: KWKHTMLTOPDF_SERVER_URL=http://localhost:8080 WKHTMLTOPDF_VERSION=${{ matrix.WKHTMLTOPDF_VERSION }} tox
30 changes: 8 additions & 22 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ install:
- sudo cp tests/travis-imagemagick-policy.xml /etc/ImageMagick-6/policy.xml
- sudo apt-get -y install -f ghostscript
# install wkhtmltopdf for native test
- wget -q -O /tmp/wkhtmltox.deb https://downloads.wkhtmltopdf.org/0.12/0.12.5/wkhtmltox_0.12.5-1.xenial_amd64.deb
- wget -q -O /tmp/wkhtmltox.deb https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox_0.12.5-1.xenial_amd64.deb
- sudo apt -y install -f /tmp/wkhtmltox.deb
# build and start server image
- docker build -f Dockerfile-${WKHTMLTOPDF_VERSION} -t kwkhtmltopdf:${WKHTMLTOPDF_VERSION} .
Expand All @@ -34,28 +34,14 @@ after_script:

jobs:
include:
- stage: test
env:
- WKHTMLTOPDF_VERSION=0.12.1.3
- stage: test
env:
- WKHTMLTOPDF_VERSION=0.12.5
- stage: deploy
install:
- go build client/go/kwkhtmltopdf_client.go
- go build server/kwkhtmltopdf_server.go
- sha1sum kwkhtmltopdf_client kwkhtmltopdf_server > SHA1SUMS
script: skip
after_script: skip
deploy:
provider: releases
api_key:
secure: H8OMvqw40jEffhfNTKtNM2eI6X6Jv/FiXdMotImCIPScSjTw6s7oRIiE3zBdJLg6o+5MTkZI6ihLXVZaEstFC99fx7VRVTb/n6JMS96kDqqdqjmAuHtG2ovN6gR65l1TPbeAinOrk4B5kPBLqOjQGLnrVF6pE12dScExCVF9ckXUTnwkDhpReTK2e0m0KEQBLcGeGEFYSIEkMFqWfl3WealLBnSgYFpU0bphYy44uNVWdHtqKpF9hMRuPq3FM+H7eKZhNF34Q+XzULZd7WfU8DeQ0ZtVTlCK3djqLI2kMm/QULjLGAQVRiG8F0xlQ5T7iIaS+VK5WTg8v6zXEFVEbxkWv5oCJuS8tUy3iCyQ9lhgY173fyOhnwGBYzQFP2M82T9o2UiSu5JzxMWHYKResHO3c1nLQ27eP5hnSQxJe0DHvBBKD5H3/lpxfET0/JszXvNMezWmOA7QaQBFQdDwGPftQm4AZlv5eh7Wgr5SZFbhqc+UGGg4rl5WXOBJ+/XruKUSMVFh3wJNitXEvtEKSqb8MjiPqJi5ApKsrIt6CuLnhLWFXIDDMGj3oznRvKyLA2SPWk3Xcpny6zt2uZ6XpeiJqOQhiete5udEjfPZ27rGHra8JEj4ARCUJXEDo1iAJPFbJXLxjCw08BFAik19mUiK3VhUZZ5j36wtQaggzB4=
skip_cleanup: true
file:
- kwkhtmltopdf_client
- kwkhtmltopdf_server
- SHA1SUMS
on:
repo: acsone/kwkhtmltopdf
tags: true
script:
- echo ${GITHUB_PACKAGE_TOKEN} | docker login ghcr.io --username "${GITHUB_PACKAGE_USER}" --password-stdin
- BUILD_NAME=${WKHTMLTOPDF_VERSION}-${TRAVIS_TAG}
- docker tag kwkhtmltopdf:${WKHTMLTOPDF_VERSION} ghcr.io/camptocamp/kwkhtmltopdf:${BUILD_NAME}
- docker push ghcr.io/camptocamp/kwkhtmltopdf:${BUILD_NAME}
env:
- WKHTMLTOPDF_VERSION=0.12.5
9 changes: 5 additions & 4 deletions Dockerfile-0.12.1.3
Original file line number Diff line number Diff line change
@@ -1,23 +1,24 @@
# first stage: build server

FROM golang:1.11
FROM docker.io/golang:1.11
WORKDIR /tmp
COPY server/kwkhtmltopdf_server.go .
RUN go build kwkhtmltopdf_server.go

# second stage: server with wkhtmltopdf

FROM ubuntu:18.04
FROM docker.io/ubuntu:18.04

RUN set -x \
&& apt update \
&& apt -y install --no-install-recommends wget ca-certificates fonts-liberation2 \
&& wget -q -O /tmp/wkhtmltox.deb https://builds.wkhtmltopdf.org/0.12.1.3/wkhtmltox_0.12.1.3-1~bionic_amd64.deb \
&& wget -q -O /tmp/wkhtmltox.deb https://download.odoo.com/deb/bionic/wkhtmltox_0.12.1.3-1~bionic_amd64.deb \
&& echo "da820f2455da0e271cda6a724c9cf24ebdc96af3 /tmp/wkhtmltox.deb" | sha1sum -c - \
&& apt -y install /tmp/wkhtmltox.deb \
&& apt -y purge wget --autoremove \
&& apt -y clean \
&& rm -rf /var/lib/apt/lists/*
&& rm -rf /var/lib/apt/lists/* \
&& rm /tmp/wkhtmltox.deb

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

Expand Down
22 changes: 14 additions & 8 deletions Dockerfile-0.12.5
Original file line number Diff line number Diff line change
@@ -1,25 +1,31 @@
# first stage: build kwkhtmltopdf_server

FROM golang:1.11
WORKDIR /tmp
FROM docker.io/golang:1.18.3
RUN mkdir /tmp/kwkhtml
WORKDIR /tmp/kwkhtml
COPY server/kwkhtmltopdf_server.go .
RUN go mod init kwkhtml
RUN go get -u github.com/rs/zerolog/[email protected]
RUN go get -u github.com/pkg/[email protected]

RUN go build kwkhtmltopdf_server.go

# second stage: server with wkhtmltopdf

FROM ubuntu:18.04
FROM debian:bullseye-slim

RUN set -x \
&& apt update \
&& apt -y install --no-install-recommends wget ca-certificates fonts-liberation2 \
&& wget -q -O /tmp/wkhtmltox.deb https://downloads.wkhtmltopdf.org/0.12/0.12.5/wkhtmltox_0.12.5-1.bionic_amd64.deb \
&& echo "f1689a1b302ff102160f2693129f789410a1708a /tmp/wkhtmltox.deb" | sha1sum -c - \
&& apt -y install --no-install-recommends wget ca-certificates fonts-liberation2 fonts-nanum-coding fonts-horai-umefont fonts-wqy-microhei \
&& wget -q -O /tmp/wkhtmltox.deb https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox_0.12.5-1.buster_amd64.deb \
&& echo "ea8277df4297afc507c61122f3c349af142f31e5 /tmp/wkhtmltox.deb" | sha1sum -c - \
&& apt -y install /tmp/wkhtmltox.deb \
&& apt -y purge wget --autoremove \
&& apt -y clean \
&& rm -rf /var/lib/apt/lists/*
&& rm -rf /var/lib/apt/lists/* \
&& rm /tmp/wkhtmltox.deb

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

RUN adduser --disabled-password --gecos '' kwkhtmltopdf
USER kwkhtmltopdf
Expand Down
9 changes: 4 additions & 5 deletions 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 acsone/kwkhtmltopdf
$ docker run --rm -p 8080:8080 ghcr.io/acsone/kwkhtmltopdf:0.12.5-latest
```

or
Expand Down Expand Up @@ -86,11 +86,10 @@ as well as some TODO's in the source code.

Push the master branch and ensure tests pass on travis.

Create and push a git tag.
Build the go client and server as explained above. Create and tag a release on GitHub
and attach the client and server you just built to it.

Travis will create a GitHub release with the client and server binaries.

[Docker Hub](https://cloud.docker.com/u/acsone/repository/docker/acsone/kwkhtmltopdf) will build the images.
Images are built and pushed to ghcr.io by a GitHub action.

## Credits

Expand Down
Loading