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

RFC: Mount package.json for Corepack #1512

Merged
merged 1 commit into from
Apr 2, 2024
Merged
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
10 changes: 6 additions & 4 deletions docs/deep-dives/pnpm.md
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,9 @@ This migration guide assumes that your project was scaffolded with a **skuba** t
```diff
FROM --platform=arm64 node:20-alpine AS dev-deps

+ RUN corepack enable pnpm
+ RUN --mount=type=bind,source=package.json,target=package.json \
+ corepack enable pnpm

+ RUN pnpm config set store-dir /root/.pnpm-store

WORKDIR /workdir
Expand Down Expand Up @@ -279,7 +281,7 @@ This migration guide assumes that your project was scaffolded with a **skuba** t
Your build pipeline may have previously output an ephemeral `.npmrc` with an auth token on the build agent.
This needs to be output elsewhere to avoid overwriting the new pnpm configuration stored in `.npmrc`.

Swap out caching on `package.json` and `yarn.lock` for `.npmrc` and `pnpm-lock.yaml` at the same time.
Swap out caching on `yarn.lock` for `.npmrc` and `pnpm-lock.yaml` at the same time.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cc @samchungy as I know you have opinions about caching

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sadge but there is no better solution imo


```diff
seek-oss/private-npm#v1.2.0:
Expand All @@ -290,9 +292,9 @@ This migration guide assumes that your project was scaffolded with a **skuba** t
```diff
seek-oss/docker-ecr-cache#v2.1.0:
cache-on:
- - package.json
- - yarn.lock
+ - .npmrc
- package.json
- - yarn.lock
+ - pnpm-lock.yaml
dockerfile: Dockerfile.dev-deps
- secrets: id=npm,src=.npmrc
Expand Down
1 change: 1 addition & 0 deletions template/express-rest-api/.buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ configs:
seek-oss/docker-ecr-cache#v2.1.1: &docker-ecr-cache-defaults
cache-on:
- .npmrc
- package.json
- pnpm-lock.yaml
dockerfile: Dockerfile.dev-deps
secrets: id=npm,src=tmp/.npmrc
Expand Down
4 changes: 3 additions & 1 deletion template/express-rest-api/Dockerfile.dev-deps
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

FROM --platform=<%- platformName %> node:20-alpine AS dev-deps

RUN corepack enable pnpm
RUN --mount=type=bind,source=package.json,target=package.json \
corepack enable pnpm

RUN pnpm config set store-dir /root/.pnpm-store

WORKDIR /workdir
Expand Down
3 changes: 3 additions & 0 deletions template/greeter/.buildkite/pipeline.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
agents:
queue: <%- prodBuildkiteQueueName %>

# Allow conditional unblock + dodgy CI stuffs

configs:
plugins:
- &aws-sm
Expand All @@ -12,6 +14,7 @@ configs:
seek-oss/docker-ecr-cache#v2.1.1:
cache-on:
- .npmrc
- package.json
- pnpm-lock.yaml
secrets: id=npm,src=tmp/.npmrc

Expand Down
4 changes: 3 additions & 1 deletion template/greeter/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

FROM --platform=<%- platformName %> node:20-alpine AS dev-deps

RUN corepack enable pnpm
RUN --mount=type=bind,source=package.json,target=package.json \
corepack enable pnpm

RUN pnpm config set store-dir /root/.pnpm-store

WORKDIR /workdir
Expand Down
1 change: 1 addition & 0 deletions template/koa-rest-api/.buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ configs:
seek-oss/docker-ecr-cache#v2.1.1: &docker-ecr-cache-defaults
cache-on:
- .npmrc
- package.json
- pnpm-lock.yaml
dockerfile: Dockerfile.dev-deps
secrets: id=npm,src=tmp/.npmrc
Expand Down
4 changes: 3 additions & 1 deletion template/koa-rest-api/Dockerfile.dev-deps
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

FROM --platform=<%- platformName %> node:20-alpine AS dev-deps

RUN corepack enable pnpm
RUN --mount=type=bind,source=package.json,target=package.json \
corepack enable pnpm

RUN pnpm config set store-dir /root/.pnpm-store

WORKDIR /workdir
Expand Down
1 change: 1 addition & 0 deletions template/lambda-sqs-worker-cdk/.buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ configs:
seek-oss/docker-ecr-cache#v2.1.1: &docker-ecr-cache-defaults
cache-on:
- .npmrc
- package.json
- pnpm-lock.yaml
secrets: id=npm,src=tmp/.npmrc

Expand Down
4 changes: 3 additions & 1 deletion template/lambda-sqs-worker-cdk/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ FROM --platform=<%- platformName %> node:20-alpine AS dev-deps
# Needed for cdk
RUN apk add --no-cache bash

RUN corepack enable pnpm
RUN --mount=type=bind,source=package.json,target=package.json \
corepack enable pnpm

RUN pnpm config set store-dir /root/.pnpm-store

WORKDIR /workdir
Expand Down
1 change: 1 addition & 0 deletions template/lambda-sqs-worker/.buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ configs:
seek-oss/docker-ecr-cache#v2.1.1: &docker-ecr-cache-defaults
cache-on:
- .npmrc
- package.json
- pnpm-lock.yaml
secrets: id=npm,src=tmp/.npmrc

Expand Down
4 changes: 3 additions & 1 deletion template/lambda-sqs-worker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

FROM --platform=<%- platformName %> node:20-alpine AS dev-deps

RUN corepack enable pnpm
RUN --mount=type=bind,source=package.json,target=package.json \
corepack enable pnpm

RUN pnpm config set store-dir /root/.pnpm-store

WORKDIR /workdir
Expand Down
Loading