Skip to content

Commit

Permalink
fix: update container image
Browse files Browse the repository at this point in the history
  • Loading branch information
spnngl committed Nov 2, 2023
1 parent fbaf474 commit bf9d785
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 5 deletions.
7 changes: 7 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.git*
Dockerfile*
Containerfile*
.dockerignore
.pre-commit*
docker-compose.yml
venv*
20 changes: 16 additions & 4 deletions Containerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,22 @@
FROM buildkite/puppeteer
FROM node:bookworm-slim

WORKDIR .
# We don't need the standalone Chromium
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD true
ENV DEBIAN_FRONTEND=noninteractive

RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y awscli curl
# Install Google Chrome Stable and fonts
# Note: this installs the necessary libs to make the browser work with Puppeteer.
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked apt-get update \
&& apt-get install -y gnupg wget awscli curl \
&& wget --quiet --output-document=- https://dl-ssl.google.com/linux/linux_signing_key.pub | gpg --dearmor > /etc/apt/trusted.gpg.d/google-archive.gpg \
&& 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 google-chrome-stable -y --no-install-recommends \
&& rm -rf /var/lib/apt/lists/*

COPY grafana_pdf.js grafana_pdf_exporter.sh sendgridSendEmail.sh ./
USER node
WORKDIR /app

COPY --chown=node:node . .

# just run the container doing nothing
ENTRYPOINT ["sh", "-c", "sleep infinity"]
10 changes: 9 additions & 1 deletion grafana_pdf.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,15 @@ const width_px = 1200;
const auth_header = 'Basic ' + new Buffer.from(auth_string).toString('base64');

(async() => {
const browser = await puppeteer.launch({args: ['--no-sandbox', '--disable-setuid-sandbox']})
const browser = await puppeteer.launch({
args: [
'--no-sandbox',
'--disable-setuid-sandbox',
'--disable-dev-shm-usage',
'--disable-gpu',
],
executablePath: '/usr/bin/google-chrome',
});
const page = await browser.newPage();

// Set basic auth headers
Expand Down

0 comments on commit bf9d785

Please sign in to comment.