Adds support for dynamically setting CHROME_BIN
See https://github.com/schliflo/docker-puppeteer/issues/6 for context
This commit is contained in:
parent
9b017c3ebe
commit
4e18ffa3ab
|
@ -1,5 +1,9 @@
|
|||
# CHANGELOG
|
||||
|
||||
# 2.0.9
|
||||
|
||||
- Bumps puppeteer to 3.0.1
|
||||
|
||||
# 2.0.0
|
||||
|
||||
- Bumps puppeteer to `1.20.0`
|
||||
|
|
13
Dockerfile
13
Dockerfile
|
@ -5,15 +5,8 @@ LABEL maintainer "Nemo <docker@captnemo.in>"
|
|||
ARG BUILD_DATE
|
||||
ARG VCS_REF
|
||||
|
||||
ENV CHROME_REVISION=737027
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# So I can copy it to the above variable
|
||||
RUN ls "/usr/local/share/.config/yarn/global/node_modules/puppeteer/.local-chromium/"
|
||||
# Ensure that the chromium path hasn't changed (this fails the build early)
|
||||
RUN ls "/usr/local/share/.config/yarn/global/node_modules/puppeteer/.local-chromium/linux-$CHROME_REVISION/chrome-linux/chrome"
|
||||
|
||||
COPY package.json package-lock.json /app/
|
||||
|
||||
RUN npm install
|
||||
|
@ -25,10 +18,8 @@ LABEL org.label-schema.build-date=$BUILD_DATE \
|
|||
org.label-schema.vcs-ref=$VCS_REF \
|
||||
org.label-schema.schema-version="1.0.0-rc1"
|
||||
|
||||
COPY index.js server.js prom.js *.md /app/
|
||||
COPY index.js server.js prom.js *.md init.sh /app/
|
||||
|
||||
ENV CHROME_BIN="/usr/local/share/.config/yarn/global/node_modules/puppeteer/.local-chromium/linux-$CHROME_REVISION/chrome-linux/chrome"
|
||||
|
||||
ENTRYPOINT ["/usr/local/bin/node", "server.js"]
|
||||
ENTRYPOINT ["/app/init.sh"]
|
||||
|
||||
EXPOSE 3000
|
||||
|
|
|
@ -62,6 +62,15 @@ You can pass the following environment variables:
|
|||
2. `CHROME_BIN`: Set Chrome/Chromium executable path.
|
||||
3. `DISABLE_HEADLESS`: If set, chrome will not launch in headless mode.
|
||||
|
||||
# Usage
|
||||
|
||||
## Docker
|
||||
|
||||
If running via Docker, here are some simple cookbook configurations:
|
||||
|
||||
docker run -it -p 3000:3000 -e captn3m0/prometheus-act-exporter
|
||||
: Run a simple test server locally in debug mode and test it on http://localhost:3000
|
||||
|
||||
# LICENSE
|
||||
|
||||
This is licensed under WTFPL. See COPYING file for the full text.
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
#!/bin/sh
|
||||
export CHROME_REVISION=$(node -e "console.log(require('/usr/local/share/.config/yarn/global/node_modules/puppeteer/package.json')['puppeteer']['chromium_revision'])")
|
||||
export CHROME_BIN="/usr/local/share/.config/yarn/global/node_modules/puppeteer/.local-chromium/linux-$CHROME_REVISION/chrome-linux/chrome"
|
||||
env
|
||||
ls -lah $CHROME_BIN
|
||||
echo $CHROME_BIN
|
||||
/usr/local/bin/node server.js $@
|
Loading…
Reference in New Issue