Fix Chromium execution failure in Docker containers (#7887)

This commit is contained in:
Alex Kriuchykhin 2024-09-25 14:57:46 +02:00 committed by GitHub
parent a4f5b3c724
commit 27a0f462eb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 5 additions and 4 deletions

View file

@ -28,7 +28,7 @@ RUN apt-get update -qq && \
ENV PATH=/usr/share/nodejs/yarn/bin:$PATH
RUN yarn add puppeteer@npm:puppeteer-core
RUN yarn add puppeteer@npm:puppeteer-core@^22.15.0
ENV BUNDLE_PATH /usr/local/bundle/
@ -39,7 +39,7 @@ RUN mkdir $APP_HOME
RUN adduser --uid 1000 scinote
RUN chown scinote:scinote $APP_HOME
USER scinote
ENV CHROMIUM_PATH /usr/bin/chromium
ENV CHROMIUM_PATH=$APP_HOME/bin/chromium
WORKDIR $APP_HOME
CMD rails s -b 0.0.0.0

View file

@ -104,7 +104,6 @@ USER scinote
COPY --from=builder --chown=scinote:scinote $APP_HOME $APP_HOME
ENV CHROMIUM_PATH /usr/bin/chromium
WORKDIR $APP_HOME
CMD rails s -b 0.0.0.0

2
bin/chromium Executable file
View file

@ -0,0 +1,2 @@
#!/bin/bash
env -i /usr/bin/chromium $@

View file

@ -3,7 +3,7 @@
Grover.configure do |config|
config.options = {
cache: false,
executable_path: ENV['CHROMIUM_PATH'] || '/usr/bin/chromium',
executable_path: ENV['CHROMIUM_PATH'] || './bin/chromium',
launch_args: %w(--disable-dev-shm-usage --disable-gpu --no-sandbox),
timeout: Constants::GROVER_TIMEOUT_MS
}