Skip to content

Commit

Permalink
Add support for Ubuntu 22.04
Browse files Browse the repository at this point in the history
  • Loading branch information
johnhailu committed Nov 15, 2022
1 parent a68525b commit b9464a8
Show file tree
Hide file tree
Showing 9 changed files with 34 additions and 2 deletions.
8 changes: 8 additions & 0 deletions .docker/Dockerfile-ubuntu_22.04
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FROM ubuntu:22.04

ENV DEBIAN_FRONTEND noninteractive

RUN apt-get update
RUN apt-get install -y ruby libjpeg8 libxrender1 libfontconfig1

CMD /root/wkhtmltopdf_binary_gem/bin/wkhtmltopdf --version
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ bin/wkhtmltopdf_macos_cocoa
bin/wkhtmltopdf_ubuntu_16.04_amd64
bin/wkhtmltopdf_ubuntu_18.04_amd64
bin/wkhtmltopdf_ubuntu_20.04_amd64
bin/wkhtmltopdf_ubuntu_22.04_amd64
bin/wkhtmltopdf_centos_6_i386
bin/wkhtmltopdf_centos_7_i386
bin/wkhtmltopdf_debian_9_i386
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

- Setup of Github action automation for Linux/MacOS builds

# 0.12.6.6

Add support for Ubuntu 22.04

# 0.12.6.5

Fix ability to use on Debian 9 systems
Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,12 @@ macOS
Binaries should be compressed with `gzip --best` after extracting. The matching binary will be extracted on first
execution of `bin/wkhtmltopdf`.

Hints for compressing binaries

Debian/Ubuntu
user/local/bin refers to the extracted binaries directory
gzip --best -c usr/local/bin/wkhtmltopdf > wkhtmltopdf_ubuntu_22.04.amd64.gz

## Testing

To execute gem tests locally, install in your OS:
Expand Down
4 changes: 3 additions & 1 deletion bin/wkhtmltopdf
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ suffix = case RbConfig::CONFIG['host_os']
os = 'ubuntu_20.04' if os.start_with?('ubuntu_20.') ||
os.start_with?('ubuntu_21.')

os = 'ubuntu_22.04' if os.start_with?('ubuntu_22.')

os = 'centos_6' if (os.start_with?('amzn_') && os != 'amzn_2') ||
(os.empty? && File.read('/etc/centos-release').start_with?('CentOS release 6'))

Expand Down Expand Up @@ -64,7 +66,7 @@ if File.exist?("#{binary}.gz") && !File.exist?(binary)
end

unless File.exist? binary
raise 'Invalid platform, must be running on Ubuntu 16.04/18.04/20.04, ' \
raise 'Invalid platform, must be running on Ubuntu 16.04/18.04/20.04/22.04, ' \
'CentOS 6/7/8, Debian 9/10, Archlinux amd64, or Intel-based Cocoa macOS ' \
"(missing binary: #{binary})."
end
Expand Down
Binary file added bin/wkhtmltopdf_ubuntu_22.04_amd64.gz
Binary file not shown.
7 changes: 7 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,13 @@ services:
volumes:
- .:/root/wkhtmltopdf_binary_gem

ubuntu_22.04:
build:
context: .
dockerfile: .docker/Dockerfile-ubuntu_22.04
volumes:
- .:/root/wkhtmltopdf_binary_gem

debian_9:
build:
context: .
Expand Down
4 changes: 4 additions & 0 deletions test/test_with_docker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ def test_with_ubuntu_20
test with: 'ubuntu_20.04'
end

def test_with_ubuntu_22
test with: 'ubuntu_22.04'
end

def test_with_archlinux
test with: 'archlinux'
end
Expand Down
2 changes: 1 addition & 1 deletion wkhtmltopdf-binary.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Gem::Specification.new do |s|
s.name = "wkhtmltopdf-binary"
s.version = "0.12.6.5"
s.version = "0.12.6.6"
s.license = "Apache-2.0"
s.author = "Zakir Durumeric"
s.email = "[email protected]"
Expand Down

0 comments on commit b9464a8

Please sign in to comment.