Skip to content

Commit 434e36a

Browse files
committed
Update Dockerfile to work with pnpm upgrade
1 parent ff9ef83 commit 434e36a

File tree

9 files changed

+29
-26
lines changed

9 files changed

+29
-26
lines changed

docker/Dockerfile

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ FROM ${NODE_IMAGE} AS pruner
88
WORKDIR /triggerdotdev
99

1010
COPY --chown=node:node . .
11-
RUN npx -q turbo@1.10.9 prune --scope=webapp --docker
11+
RUN npx -q turbo@2.5.4 prune --scope=webapp --docker
1212
RUN find . -name "node_modules" -type d -prune -exec rm -rf '{}' +
1313

1414
# Base strategy to have layer caching
@@ -19,34 +19,34 @@ COPY --chown=node:node .gitignore .gitignore
1919
COPY --from=pruner --chown=node:node /triggerdotdev/out/json/ .
2020
COPY --from=pruner --chown=node:node /triggerdotdev/out/pnpm-lock.yaml ./pnpm-lock.yaml
2121
COPY --from=pruner --chown=node:node /triggerdotdev/out/pnpm-workspace.yaml ./pnpm-workspace.yaml
22+
COPY --chown=node:node patches ./patches
2223

2324
## Dev deps
2425
FROM base AS dev-deps
2526
WORKDIR /triggerdotdev
26-
# Corepack is used to install pnpm
27-
RUN corepack enable
28-
ENV NODE_ENV development
29-
RUN --mount=type=cache,id=pnpm,target=/root/.local/share/pnpm/store pnpm install --ignore-scripts --no-frozen-lockfile
27+
# Corepack is used to install pnpm with the exact version from packageManager
28+
RUN corepack enable && corepack prepare pnpm@10.23.0 --activate
29+
ENV NODE_ENV=development
30+
RUN --mount=type=cache,id=pnpm,target=/root/.local/share/pnpm/store pnpm install --no-frozen-lockfile
31+
# Generate Prisma client here where all deps are installed
32+
COPY --from=pruner --chown=node:node /triggerdotdev/internal-packages/database/prisma/schema.prisma /triggerdotdev/internal-packages/database/prisma/schema.prisma
33+
RUN pnpx prisma@6.14.0 generate --schema /triggerdotdev/internal-packages/database/prisma/schema.prisma
3034

3135
## Production deps
3236
FROM base AS production-deps
3337
WORKDIR /triggerdotdev
34-
# Corepack is used to install pnpm
35-
RUN corepack enable
36-
ENV NODE_ENV production
38+
# Corepack is used to install pnpm with the exact version from packageManager
39+
RUN corepack enable && corepack prepare pnpm@10.23.0 --activate
40+
ENV NODE_ENV=production
3741
RUN --mount=type=cache,id=pnpm,target=/root/.local/share/pnpm/store pnpm install --prod --no-frozen-lockfile
38-
COPY --from=pruner --chown=node:node /triggerdotdev/internal-packages/database/prisma/schema.prisma /triggerdotdev/internal-packages/database/prisma/schema.prisma
39-
# RUN pnpm add @prisma/client@6.14.0 -w
40-
ENV NPM_CONFIG_IGNORE_WORKSPACE_ROOT_CHECK true
41-
RUN --mount=type=cache,id=pnpm,target=/root/.local/share/pnpm/store pnpx prisma@6.14.0 generate --schema /triggerdotdev/internal-packages/database/prisma/schema.prisma
4242

4343
## Builder (builds the webapp)
4444
FROM base AS builder
4545
# This is needed for the sentry-cli binary while building the webapp
4646
RUN apt-get update && apt-get install -y openssl dumb-init ca-certificates
4747
WORKDIR /triggerdotdev
48-
# Corepack is used to install pnpm
49-
RUN corepack enable
48+
# Corepack is used to install pnpm with the exact version from packageManager
49+
RUN corepack enable && corepack prepare pnpm@10.23.0 --activate
5050

5151
ARG SENTRY_RELEASE
5252
ARG SENTRY_ORG
@@ -67,7 +67,7 @@ COPY --chown=node:node docker/scripts ./scripts
6767
RUN chmod +x ./scripts/wait-for-it.sh
6868
RUN chmod +x ./scripts/entrypoint.sh
6969
COPY --chown=node:node .configs/tsconfig.base.json .configs/tsconfig.base.json
70-
COPY --chown=node:node scripts/updateVersion.ts scripts/updateVersion.ts
70+
COPY --chown=node:node scripts/updateVersion.mjs scripts/updateVersion.mjs
7171
RUN pnpm run generate
7272
RUN --mount=type=secret,id=sentry_auth_token \
7373
SENTRY_AUTH_TOKEN=$(cat /run/secrets/sentry_auth_token) \
@@ -77,11 +77,13 @@ RUN --mount=type=secret,id=sentry_auth_token \
7777
FROM ${NODE_IMAGE} AS runner
7878
RUN apt-get update && apt-get install -y openssl netcat-openbsd ca-certificates
7979
WORKDIR /triggerdotdev
80-
ENV NODE_ENV production
80+
ENV NODE_ENV=production
8181

8282
COPY --from=base /usr/bin/dumb-init /usr/bin/dumb-init
8383
COPY --from=pruner --chown=node:node /triggerdotdev/out/full/ .
8484
COPY --from=production-deps --chown=node:node /triggerdotdev .
85+
# Copy generated Prisma client from dev-deps
86+
COPY --from=dev-deps --chown=node:node /triggerdotdev/internal-packages/database/generated ./internal-packages/database/generated
8587
COPY --from=builder --chown=node:node /triggerdotdev/apps/webapp/build/server.js ./apps/webapp/build/server.js
8688
COPY --from=builder --chown=node:node /triggerdotdev/apps/webapp/build ./apps/webapp/build
8789
COPY --from=builder --chown=node:node /triggerdotdev/apps/webapp/public ./apps/webapp/public
@@ -104,11 +106,11 @@ ENV BUILD_APP_VERSION=${BUILD_APP_VERSION} \
104106
EXPOSE 3000
105107

106108
# Add global pnpm shims and install pnpm during build (root user)
107-
RUN corepack enable && corepack prepare --activate
109+
RUN corepack enable && corepack prepare pnpm@10.23.0 --activate
108110

109111
USER node
110112

111113
# Ensure pnpm is installed during build and not silently downloaded at runtime (node user)
112-
RUN corepack prepare --activate
114+
RUN corepack prepare pnpm@10.23.0 --activate
113115

114116
CMD ["./scripts/entrypoint.sh"]

packages/build/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@
7373
"build": "tshy && pnpm run update-version",
7474
"dev": "tshy --watch",
7575
"typecheck": "tsc --noEmit -p tsconfig.src.json",
76-
"update-version": "node ../../scripts/updateVersion.ts",
76+
"update-version": "node ../../scripts/updateVersion.mjs",
7777
"check-exports": "attw --pack ."
7878
},
7979
"dependencies": {

packages/cli-v3/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@
7474
"dev": "tshy --watch",
7575
"test": "vitest",
7676
"test:e2e": "vitest --run -c ./e2e/vitest.config.ts",
77-
"update-version": "node ../../scripts/updateVersion.ts",
77+
"update-version": "node ../../scripts/updateVersion.mjs",
7878
"install-mcp": "./install-mcp.sh",
7979
"inspector": "npx @modelcontextprotocol/inspector dist/esm/index.js mcp --log-file .mcp.log --api-url http://localhost:3030"
8080
},

packages/core/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@
158158
"sideEffects": false,
159159
"scripts": {
160160
"clean": "rimraf dist .tshy .tshy-build .turbo",
161-
"update-version": "node ../../scripts/updateVersion.ts",
161+
"update-version": "node ../../scripts/updateVersion.mjs",
162162
"build": "tshy && pnpm run update-version",
163163
"dev": "tshy --watch",
164164
"typecheck": "tsc --noEmit -p tsconfig.src.json",

packages/python/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
"build": "tshy && pnpm run update-version",
4242
"dev": "tshy --watch",
4343
"typecheck": "tsc --noEmit -p tsconfig.src.json",
44-
"update-version": "node ../../scripts/updateVersion.ts",
44+
"update-version": "node ../../scripts/updateVersion.mjs",
4545
"check-exports": "attw --pack ."
4646
},
4747
"dependencies": {

packages/react-hooks/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
"build": "tshy && pnpm run update-version",
3434
"dev": "tshy --watch",
3535
"typecheck": "tsc --noEmit",
36-
"update-version": "node ../../scripts/updateVersion.ts",
36+
"update-version": "node ../../scripts/updateVersion.mjs",
3737
"check-exports": "attw --pack ."
3838
},
3939
"dependencies": {

packages/schema-to-json/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
"dev": "tshy --watch",
3838
"typecheck": "tsc -p tsconfig.src.json --noEmit",
3939
"test": "vitest",
40-
"update-version": "node ../../scripts/updateVersion.ts",
40+
"update-version": "node ../../scripts/updateVersion.mjs",
4141
"check-exports": "attw --pack ."
4242
},
4343
"dependencies": {

packages/trigger-sdk/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
"build": "tshy && pnpm run update-version",
4646
"dev": "tshy --watch",
4747
"typecheck": "tsc --noEmit",
48-
"update-version": "node ../../scripts/updateVersion.ts",
48+
"update-version": "node ../../scripts/updateVersion.mjs",
4949
"check-exports": "attw --pack ."
5050
},
5151
"dependencies": {

scripts/updateVersion.ts renamed to scripts/updateVersion.mjs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ async function updateVersion() {
2525
);
2626
}
2727

28-
async function updatePlaceholderInFile(filePath: string, version: string) {
28+
async function updatePlaceholderInFile(filePath, version) {
2929
try {
3030
const fileContents = await fs.readFile(filePath, "utf-8");
3131
const updatedContents = fileContents.replace("0.0.0", version);
@@ -37,3 +37,4 @@ updateVersion().catch((e) => {
3737
console.error(e);
3838
process.exit(1);
3939
});
40+

0 commit comments

Comments
 (0)