Skip to content

Commit

Permalink
Docker puppeteer work around (revert this later)
Browse files Browse the repository at this point in the history
- Tracked at #451
  • Loading branch information
mfix22 committed Aug 6, 2018
1 parent cc2cafa commit 02d2a95
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 18 deletions.
17 changes: 11 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,18 +1,23 @@
FROM node:9-alpine

# Installs latest Chromium (63) package.
# Source https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md
# Installs latest Chromium (68) package.
ENV CHROME_BIN=/usr/bin/chromium-browser
RUN apk update && apk upgrade && \
echo @edge http://nl.alpinelinux.org/alpine/edge/community >> /etc/apk/repositories && \
echo @edge http://nl.alpinelinux.org/alpine/edge/main >> /etc/apk/repositories && \
echo @v3.8 http://nl.alpinelinux.org/alpine/v3.8/community >> /etc/apk/repositories && \
echo @v3.8 http://nl.alpinelinux.org/alpine/v3.8/main >> /etc/apk/repositories && \
apk add --no-cache \
chromium@edge \
nss@edge
chromium@v3.8 \
nss@v3.8

WORKDIR /app

COPY package.json ./
COPY yarn.lock ./

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

RUN yarn

COPY . .
Expand All @@ -30,4 +35,4 @@ USER pptruser

ENV NODE_ENV production
EXPOSE 3000
CMD [ "yarn", "start" ]
CMD [ "yarn", "start" ]
2 changes: 1 addition & 1 deletion handlers/image.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ module.exports = browser => async (req, res) => {

const targetElement = await page.$('#export-container')

const dataUrl = await page.evaluate(target => {
const dataUrl = await page.evaluate((target = document) => {
const config = {
style: {
transform: 'scale(2)',
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"ms": "^2.0.0",
"next": "^6.0.3",
"now-logs": "^0.0.7",
"puppeteer": "^1.0.0",
"puppeteer": "0.13.x",
"react": "16.3.*",
"react-click-outside": "^3.0.0",
"react-codemirror2": "^5.0.0",
Expand Down
3 changes: 2 additions & 1 deletion server.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ const puppeteerParams = dev
? {}
: {
executablePath: '/usr/bin/chromium-browser',
args: ['--no-sandbox', '--disable-setuid-sandbox']
// TODO args: ['--no-sandbox', '--disable-setuid-sandbox']
args: ['--no-sandbox', '--headless', '--disable-gpu']
}

app
Expand Down
14 changes: 5 additions & 9 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4514,10 +4514,6 @@ mime@^1.3.4:
version "1.6.0"
resolved "https://registry.yarnpkg.com/mime/-/mime-1.6.0.tgz#32cd9e5c64553bd58d19a568af452acff04981b1"

mime@^2.0.3:
version "2.3.1"
resolved "https://registry.yarnpkg.com/mime/-/mime-2.3.1.tgz#b1621c54d63b97c47d3cfe7f7215f7d64517c369"

mimic-fn@^1.0.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-1.2.0.tgz#820c86a39334640e99516928bd03fca88057d022"
Expand Down Expand Up @@ -5683,14 +5679,14 @@ punycode@^2.1.0:
version "2.1.1"
resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.1.1.tgz#b58b010ac40c22c5657616c8d2c2c02c7bf479ec"

puppeteer@^1.0.0:
version "1.4.0"
resolved "https://registry.yarnpkg.com/puppeteer/-/puppeteer-1.4.0.tgz#437f0f3450d76e437185c0bf06f446e80f184692"
puppeteer@0.13.x:
version "0.13.0"
resolved "https://registry.yarnpkg.com/puppeteer/-/puppeteer-0.13.0.tgz#2e6956205f2c640964c2107f620ae1eef8bde8fd"
dependencies:
debug "^3.1.0"
debug "^2.6.8"
extract-zip "^1.6.5"
https-proxy-agent "^2.1.0"
mime "^2.0.3"
mime "^1.3.4"
progress "^2.0.0"
proxy-from-env "^1.0.0"
rimraf "^2.6.1"
Expand Down

0 comments on commit 02d2a95

Please sign in to comment.