Created
December 19, 2018 14:25
-
-
Save giladno/4765395fff9995c8bdd8c497988a18f8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM node:10-slim | |
ENV NODE_ENV=production | |
RUN apt-get update && apt-get install -yq libgconf-2-4 | |
RUN apt-get update && apt-get install -y wget --no-install-recommends \ | |
&& wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \ | |
&& sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' \ | |
&& apt-get update \ | |
&& apt-get install -y google-chrome-unstable fonts-ipafont-gothic fonts-wqy-zenhei fonts-thai-tlwg fonts-kacst ttf-freefont --no-install-recommends \ | |
&& rm -rf /var/lib/apt/lists/* \ | |
&& apt-get purge --auto-remove -y curl \ | |
&& rm -rf /src/*.deb | |
ADD https://github.com/Yelp/dumb-init/releases/download/v1.2.0/dumb-init_1.2.0_amd64 /usr/local/bin/dumb-init | |
RUN chmod +x /usr/local/bin/dumb-init | |
COPY . /app/ | |
WORKDIR /app | |
RUN npm install --quiet --no-progress && npm cache clean --force | |
RUN groupadd -r pptruser && useradd -r -g pptruser -G audio,video pptruser \ | |
&& mkdir -p /home/pptruser/Downloads \ | |
&& chown -R pptruser:pptruser /home/pptruser \ | |
&& chown -R pptruser:pptruser ./node_modules | |
USER pptruser | |
ENTRYPOINT ["dumb-init", "--"] | |
CMD ["node", "index.js"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
const puppeteer = require('puppeteer'); | |
const run = async () => { | |
const browser = await puppeteer.launch({ | |
args: ['--no-sandbox', '--disable-setuid-sandbox', '--disable-dev-shm-usage'], | |
}); | |
try { | |
const page = await browser.newPage(); | |
} catch (error) { | |
console.error(error); | |
} finally { | |
await browser.close(); | |
} | |
}; | |
(async () => { | |
await run(); | |
})().catch(err => console.error(err)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment