Skip to content

Commit 38566a2

Browse files
committed
fix: docker image not building
1 parent 366f8b9 commit 38566a2

File tree

3 files changed

+3155
-2071
lines changed

3 files changed

+3155
-2071
lines changed

Dockerfile

Lines changed: 23 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,31 @@
11
# 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"
318

419
# Copy repository
5-
COPY . /metrics
620
WORKDIR /metrics
21+
COPY . .
722

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}" \
2926
&& 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
3529

3630
# Execute GitHub action
37-
ENTRYPOINT node /metrics/source/app/action/index.mjs
31+
ENTRYPOINT ["node", "/metrics/source/app/action/index.mjs"]

0 commit comments

Comments
 (0)