Skip to content

Commit

Permalink
Specify explicit chromium version
Browse files Browse the repository at this point in the history
  • Loading branch information
gunndabad committed Nov 22, 2024
1 parent 3704790 commit 3a11e6a
Show file tree
Hide file tree
Showing 3 changed files with 187 additions and 221 deletions.
15 changes: 14 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ RUN bundler -v && \
bundle install --retry=5 --jobs=4 && \
rm -rf /usr/local/bundle/cache

# Tell Puppeteer to skip installing Chrome. We'll be using the installed package.
ENV PUPPETEER_SKIP_DOWNLOAD=true

# Install node packages defined in package.json
COPY package.json yarn.lock ./
RUN yarn install --frozen-lockfile --check-files
Expand All @@ -53,7 +56,7 @@ RUN DATABASE_PASSWORD=required-to-run-but-not-used \
bundle exec rails assets:precompile

# Cleanup to save space in the production image
RUN rm -rf node_modules log/* tmp/* /tmp && \
RUN rm -rf log/* tmp/* /tmp && \
rm -rf /usr/local/bundle/cache && \
rm -rf .env && \
find /usr/local/bundle/gems -name "*.c" -delete && \
Expand Down Expand Up @@ -82,6 +85,16 @@ RUN apk add --update --no-cache tzdata && \
# libpq: required to run postgres
RUN apk add --no-cache libpq

# install chromium and node for the PDF generation
RUN apk add --no-cache nodejs npm
RUN apk add --no-cache chromium
RUN npm install -g npx && npx puppeteer browsers install chrome

#"Could not find Chrome (ver. 131.0.6778.85). This can occur if either
# 1. you did not perform an installation before running the script (e.g. `npx puppeteer browsers install chrome`) or
# 2. your cache path is incorrectly configured (which is: /root/.cache/puppeteer).
# For (2), check out our guide on configuring puppeteer at https://pptr.dev/guides/configuration.

# Copy files generated in the builder image
COPY --from=builder /app /app
COPY --from=builder /usr/local/bundle/ /usr/local/bundle/
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
"dependencies": {
"esbuild": "^0.24.0",
"govuk-frontend": "^5.6.0",
"sass": "^1.79.3",
"puppeteer": "22.6.1"
"puppeteer": "^23.9.0",
"sass": "^1.79.3"
},
"scripts": {
"build:css": "sass ./app/assets/stylesheets/certificates.scss:./app/assets/builds/certificates.css ./app/assets/stylesheets/check_records.scss:./app/assets/builds/check_records.css ./app/assets/stylesheets/qualifications.scss:./app/assets/builds/qualifications.css --no-source-map --load-path=node_modules --quiet-deps",
Expand Down
Loading

0 comments on commit 3a11e6a

Please sign in to comment.