Skip to content

Commit d3da56d

Browse files
authored
Hotfix for fixing PDF generation (#1208)
* add missing dependencies for PDF generation * make in production only
1 parent fb90056 commit d3da56d

2 files changed

Lines changed: 12 additions & 4 deletions

File tree

Dockerfile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,10 @@ RUN apt-get update -qq && \
1616
curl \
1717
netcat-traditional \
1818
chromium \
19-
libyaml-dev
19+
libyaml-dev \
20+
fonts-liberation \
21+
&& apt-get clean \
22+
&& rm -rf /var/lib/apt/lists/*
2023

2124
# Add Node, required for asset pipeline.
2225
RUN curl -sL https://deb.nodesource.com/setup_22.x | bash - && \

config/initializers/grover.rb

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,17 @@
88
# https://github.com/Studiosity/grover
99

1010
Grover.configure do |config|
11-
# Common PDF options
12-
config.options = {
11+
options = {
1312
format: 'A4',
1413
print_background: true,
1514
prefer_css_page_size: false,
1615
display_url: "https://#{Rails.application.config.x.sofia_host}"
17-
1816
}
17+
18+
unless Rails.env.development?
19+
options[:executable_path] = '/usr/bin/chromium'
20+
options[:launch_args] = ['--no-sandbox', '--disable-setuid-sandbox', '--disable-dev-shm-usage']
21+
end
22+
23+
config.options = options
1924
end

0 commit comments

Comments
 (0)