Skip to content

Commit 5475b24

Browse files
committed
install sharp for next/image in production using pnpm
1 parent ac58844 commit 5475b24

File tree

3 files changed

+17
-0
lines changed

3 files changed

+17
-0
lines changed

Dockerfile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,15 @@ COPY --chown=node:node /src/app/db/migrations ./migrations
2323

2424
USER root
2525
RUN pnpm install --frozen-lockfile --prefer-offline
26+
RUN pnpm install sharp@0.32.6
2627

2728
# 2. Rebuild the source code only when needed
2829
FROM base AS builder
2930
WORKDIR /app
31+
# Inspired by https://github.com/vercel/next.js/discussions/36935
32+
RUN mkdir -p /app/.next/cache && chown -R node:node /app/.next/cache
33+
# Persist the next cache in a volume
34+
VOLUME ["/app/.next/cache"]
3035
COPY --from=deps --chown=node:node /app/node_modules ./node_modules
3136

3237
COPY --chown=node:node . .

package.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,5 +41,16 @@
4141
"rimraf": "^5.0.5",
4242
"tsx": "^4.7.1",
4343
"typescript": "^5.3.3"
44+
},
45+
"pnpm": {
46+
"supportedArchitectures": {
47+
"os": [
48+
"current"
49+
],
50+
"cpu": [
51+
"x64",
52+
"arm64"
53+
]
54+
}
4455
}
4556
}

src/app/db/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ const client = sqlite(url, { verbose: console.log })
1717
client.pragma('journal_mode=WAL') // see https://github.com/WiseLibs/better-sqlite3/blob/master/docs/performance.md
1818
client.pragma('synchronous=normal')
1919
client.pragma('foreign_keys=on')
20+
2021
export const db = drizzle(client)
2122

2223
// migrate(db, {

0 commit comments

Comments
 (0)