Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ jobs:
- name: Setup NodeJS
uses: actions/setup-node@v3
with:
node-version: 20
node-version: 22
- name: Pull changes
run: |
git checkout master
Expand All @@ -76,7 +76,7 @@ jobs:
- name: Setup NodeJS
uses: actions/setup-node@v3
with:
node-version: 20
node-version: 22
- name: Pull
run: git pull
- name: Checkout main
Expand Down Expand Up @@ -209,7 +209,7 @@ jobs:
- name: Setup NodeJS
uses: actions/setup-node@v3
with:
node-version: 20
node-version: 22
- name: Setup metrics
run: npm ci
- name: Pull
Expand Down Expand Up @@ -260,7 +260,7 @@ jobs:
- name: Setup NodeJS
uses: actions/setup-node@v3
with:
node-version: 20
node-version: 22
- name: Setup metrics
run: npm ci
- name: Publish release
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/examples.presets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- name: Setup NodeJS
uses: actions/setup-node@v3
with:
node-version: 20
node-version: 22
- name: Setup metrics
run: npm ci
- name: Publish presets examples
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.presets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
- name: Setup NodeJS
uses: actions/setup-node@v3
with:
node-version: 20
node-version: 22
- name: Setup metrics
run: npm ci
- name: Run tests
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- name: Setup NodeJS
uses: actions/setup-node@v3
with:
node-version: 20
node-version: 22
- name: Setup metrics
run: npm ci
- name: Check contributions requirements
Expand All @@ -45,7 +45,7 @@ jobs:
- name: Build lowlighter/metrics:${{ github.head_ref || 'master' }}
env:
GIT_REF: ${{ github.head_ref || 'master' }}
run: docker build -t lowlighter/metrics:$(echo $GIT_REF | sed 's/[^a-z]/-/g') .
run: docker build --build-arg INCLUDE_DEV_DEPS=true -t lowlighter/metrics:$(echo $GIT_REF | sed 's/[^a-z]/-/g') .
- name: Run tests
env:
GIT_REF: ${{ github.head_ref || 'master' }}
Expand Down
66 changes: 37 additions & 29 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,37 +1,45 @@
# syntax=docker/dockerfile:1.16

# Base image
FROM node:20-bookworm-slim
FROM node:22

# Install latest chrome dev package, fonts to support major charsets and skip chromium download on puppeteer install
# Based on https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md#running-puppeteer-in-docker
RUN set -x \
&& apt-get update \
&& apt-get install -y --no-install-recommends wget ca-certificates \
&& wget -q https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb \
&& 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 \
&& rm -rf ./google-chrome-stable_current_amd64.deb /var/lib/apt/lists/*

# Install deno for miscellaneous scripts
# TODO: pin major deno version
COPY --from=denoland/deno:bin /deno /usr/local/bin/deno

# Install licensed through pkgx
# TODO: pin major pkgx version
COPY --from=pkgxdev/pkgx:busybox /usr/local/bin/pkgx /usr/local/bin/pkgx
COPY --chmod=+x <<EOF /usr/local/bin/licensed
#!/usr/bin/env -S pkgx --shebang --quiet +github.com/licensee/licensed@5 -- licensed
EOF
RUN licensed --version

# Environment variables
ENV PUPPETEER_SKIP_DOWNLOAD="true"
ENV PUPPETEER_EXECUTABLE_PATH="/usr/bin/google-chrome-stable"

# Copy repository
COPY . /metrics
WORKDIR /metrics
COPY . .

# Setup
RUN chmod +x /metrics/source/app/action/index.mjs \
# Install latest chrome dev package, fonts to support major charsets and skip chromium download on puppeteer install
# Based on https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md#running-puppeteer-in-docker
&& apt-get update \
&& apt-get install -y wget gnupg ca-certificates libgconf-2-4 \
&& 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-stable fonts-ipafont-gothic fonts-wqy-zenhei fonts-thai-tlwg fonts-kacst fonts-freefont-ttf libxss1 libx11-xcb1 libxtst6 lsb-release --no-install-recommends \
# Install deno for miscellaneous scripts
&& apt-get install -y curl unzip \
&& curl -fsSL https://deno.land/x/install/install.sh | DENO_INSTALL=/usr/local sh \
# Install ruby to support github licensed gem
&& apt-get install -y ruby-full git g++ cmake pkg-config libssl-dev \
&& gem install licensed \
# Install python for node-gyp
&& apt-get install -y python3 \
# Clean apt/lists
&& rm -rf /var/lib/apt/lists/* \
# Install node modules and rebuild indexes
&& npm ci \
&& npm run build
ARG INCLUDE_DEV_DEPS="false"

# Environment variables
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD true
ENV PUPPETEER_BROWSER_PATH "google-chrome-stable"
# Install node modules and rebuild indexes
RUN set -x \
&& which "${PUPPETEER_EXECUTABLE_PATH}" \
&& npm ci \
&& npm run build \
&& if [ "${INCLUDE_DEV_DEPS}" = "false" ]; then npm prune --omit=dev; fi

# Execute GitHub action
ENTRYPOINT node /metrics/source/app/action/index.mjs
ENTRYPOINT ["node", "/metrics/source/app/action/index.mjs"]
Loading
Loading