CI: Use pnpm lockfile for next-stats-action (#92488)

Previously, we were just copying the `package.json` into the container and `pnpm install`ing it.

This wouldn't respect the lockfile or `minimumReleaseAge`. This uses `pnpm deploy` based on the documentation here: https://pnpm.io/docker
This commit is contained in:
Benjamin Woodruff
2026-04-08 08:26:17 -07:00
committed by GitHub
parent 7744647327
commit ed396cadae
5 changed files with 66 additions and 14 deletions
+21 -13
View File
@@ -1,14 +1,9 @@
# syntax=docker.io/docker/dockerfile:1
FROM ubuntu:24.04
LABEL com.github.actions.name="Next.js PR Stats"
LABEL com.github.actions.description="Compares stats of a PR with the main branch"
LABEL repository="https://github.com/vercel/next-stats-action"
ENV DEBIAN_FRONTEND=noninteractive
FROM ubuntu:24.04 AS base
# use apt-get instead of apt, because apt does not have a stable CLI interface
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get upgrade -y
RUN apt-get install -y --no-install-recommends curl ca-certificates git
@@ -16,17 +11,30 @@ RUN curl -sfLS https://install-node.vercel.app/v20.9.0 | bash -s -- -f
RUN npm i -g [email protected]
RUN corepack enable
WORKDIR /next-stats
# Install node_modules
COPY package.json ./
RUN pnpm install --production
# Do this copy after the pnpm install to optimize docker caching
COPY --exclude=node_modules . .
FROM base AS pnpm-deploy
WORKDIR /dot-github
COPY --exclude=node_modules --exclude=actions/*/node_modules . .
RUN ls -l
RUN pnpm deploy --filter=next-stats-action --production /next-stats
FROM base AS next-stats-action
LABEL com.github.actions.name="Next.js PR Stats"
LABEL com.github.actions.description="Compares stats of a PR with the main branch"
LABEL repository="https://github.com/vercel/next.js"
RUN git config --global user.email 'stats@localhost' && \
git config --global user.name 'next stats'
WORKDIR /next-stats
COPY --from=pnpm-deploy /next-stats .
RUN pnpm install --production
COPY entrypoint.sh /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
+3 -1
View File
@@ -7,4 +7,6 @@ inputs:
required: false
runs:
using: 'docker'
image: 'Dockerfile'
# this dockerfile must be located in the parent directory, otherwise
# `pnpm deploy` can't read the pnpm-lock.yaml
image: '../../next-stats-action.Dockerfile'
@@ -1,4 +1,5 @@
{
"name": "next-stats-action",
"private": true,
"main": "src/index.js",
"dependencies": {
+40
View File
@@ -0,0 +1,40 @@
# syntax=docker.io/docker/dockerfile:1
FROM ubuntu:24.04 AS base
# use apt-get instead of apt, because apt does not have a stable CLI interface
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get upgrade -y
RUN apt-get install -y --no-install-recommends curl ca-certificates git
RUN curl -sfLS https://install-node.vercel.app/v20.9.0 | bash -s -- -f
RUN npm i -g [email protected]
RUN corepack enable
FROM base AS pnpm-deploy
WORKDIR /dot-github
COPY pnpm-lock.yaml pnpm-workspace.yaml .
COPY --exclude=actions/*/node_modules \
actions/next-stats-action actions/next-stats-action
RUN pnpm deploy --filter=next-stats-action --production /next-stats
FROM base AS next-stats-action
LABEL com.github.actions.name="Next.js PR Stats"
LABEL com.github.actions.description="Compares stats of a PR with the main branch"
LABEL repository="https://github.com/vercel/next.js"
RUN git config --global user.email 'stats@localhost' && \
git config --global user.name 'next stats'
WORKDIR /next-stats
COPY --from=pnpm-deploy /next-stats .
COPY actions/next-stats-action/entrypoint.sh /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
+1
View File
@@ -1,2 +1,3 @@
packages:
- 'actions/*'
injectWorkspacePackages: true