Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[node] How to properly install pnpm? #1901

Open
shadiramadan opened this issue Nov 30, 2023 · 0 comments
Open

[node] How to properly install pnpm? #1901

shadiramadan opened this issue Nov 30, 2023 · 0 comments
Assignees
Labels
needs-triage applied to all new customer/user issues. Removed after triage occurs.

Comments

@shadiramadan
Copy link

Which image/versions are related to this issue/feature request?

cgr.dev/chainguard/node:latest-dev

Issue/Feature description

This issue is solved and is a reference to anyone looking to do the same. I understand why pnpm isn't included by default although it would be nice... but you'll get requests for yarn etc.

Referencing the docker init setup to run node with pnpm the generated Dockerfile had to be altered to work with chaingaurd:

# Install pnpm; requires changing the global npm installation directory and explicitly setting the uid and gid.
RUN --mount=type=cache,target=/home/node/.npm,uid=65532,gid=65532 \
    npm config set prefix /home/node/.npm \
    && npm install -g pnpm@${PNPM_VERSION}

ENV PATH=/home/node/.npm/bin:$PATH

# Download dependencies as a separate step to take advantage of Docker's caching.
# Leverage cache mounts to /home/node/.npm and /home/node/.local/share/pnpm/store to speed up subsequent builds.
# Leverage bind mounts to package.json and pnpm-lock.yaml to avoid having to copy them into this layer.
RUN --mount=type=bind,source=package.json,target=package.json \
    --mount=type=bind,source=pnpm-lock.yaml,target=pnpm-lock.yaml \
    --mount=type=cache,target=/home/node/.npm,uid=65532,gid=65532 \
    --mount=type=cache,target=/home/node/.local/share/pnpm/store,uid=65532,gid=65532 \
    pnpm install --prod --frozen-lockfile
@shadiramadan shadiramadan added the needs-triage applied to all new customer/user issues. Removed after triage occurs. label Nov 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-triage applied to all new customer/user issues. Removed after triage occurs.
Projects
None yet
Development

No branches or pull requests

2 participants