|
1 | 1 | # Base image
|
2 |
| -FROM node:20-bookworm-slim |
| 2 | +FROM node:22 |
| 3 | + |
| 4 | +# Install latest chrome dev package, fonts to support major charsets and skip chromium download on puppeteer install |
| 5 | +# Based on https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md#running-puppeteer-in-docker |
| 6 | +RUN set -x \ |
| 7 | + && apt-get update \ |
| 8 | + && apt-get install -y --no-install-recommends wget ca-certificates \ |
| 9 | + && wget -q https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb \ |
| 10 | + && apt-get install -y --no-install-recommends ./google-chrome-stable_current_amd64.deb fonts-ipafont-gothic fonts-wqy-zenhei fonts-thai-tlwg fonts-kacst fonts-freefont-ttf libxss1 \ |
| 11 | + && rm -rf ./google-chrome-stable_current_amd64.deb /var/lib/apt/lists/* |
| 12 | + |
| 13 | +# TODO: install licensed with pkgx https://github.com/pkgxdev/pantry/issues/9488 |
| 14 | + |
| 15 | +# Environment variables |
| 16 | +ENV PUPPETEER_SKIP_DOWNLOAD="true" |
| 17 | +ENV PUPPETEER_EXECUTABLE_PATH="/usr/bin/google-chrome-stable" |
3 | 18 |
|
4 | 19 | # Copy repository
|
5 |
| -COPY . /metrics |
6 | 20 | WORKDIR /metrics
|
| 21 | +COPY . . |
7 | 22 |
|
8 |
| -# Setup |
9 |
| -RUN chmod +x /metrics/source/app/action/index.mjs \ |
10 |
| - # Install latest chrome dev package, fonts to support major charsets and skip chromium download on puppeteer install |
11 |
| - # Based on https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md#running-puppeteer-in-docker |
12 |
| - && apt-get update \ |
13 |
| - && apt-get install -y wget gnupg ca-certificates libgconf-2-4 \ |
14 |
| - && wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \ |
15 |
| - && sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' \ |
16 |
| - && apt-get update \ |
17 |
| - && apt-get install -y google-chrome-stable fonts-ipafont-gothic fonts-wqy-zenhei fonts-thai-tlwg fonts-kacst fonts-freefont-ttf libxss1 libx11-xcb1 libxtst6 lsb-release --no-install-recommends \ |
18 |
| - # Install deno for miscellaneous scripts |
19 |
| - && apt-get install -y curl unzip \ |
20 |
| - && curl -fsSL https://deno.land/x/install/install.sh | DENO_INSTALL=/usr/local sh \ |
21 |
| - # Install ruby to support github licensed gem |
22 |
| - && apt-get install -y ruby-full git g++ cmake pkg-config libssl-dev \ |
23 |
| - && gem install licensed \ |
24 |
| - # Install python for node-gyp |
25 |
| - && apt-get install -y python3 \ |
26 |
| - # Clean apt/lists |
27 |
| - && rm -rf /var/lib/apt/lists/* \ |
28 |
| - # Install node modules and rebuild indexes |
| 23 | +# Install node modules and rebuild indexes |
| 24 | +RUN set -x \ |
| 25 | + && which "${PUPPETEER_EXECUTABLE_PATH}" \ |
29 | 26 | && npm ci \
|
30 |
| - && npm run build |
31 |
| - |
32 |
| -# Environment variables |
33 |
| -ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD true |
34 |
| -ENV PUPPETEER_BROWSER_PATH "google-chrome-stable" |
| 27 | + && npm run build \ |
| 28 | + && npm prune --omit=dev |
35 | 29 |
|
36 | 30 | # Execute GitHub action
|
37 |
| -ENTRYPOINT node /metrics/source/app/action/index.mjs |
| 31 | +ENTRYPOINT ["node", "/metrics/source/app/action/index.mjs"] |
0 commit comments