Skip to content
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
12 changes: 8 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ RUN --mount=type=cache,target=/var/cache/apk \

COPY package.json package-lock.json ./
# sharp prebuilds need x86-64-v2 (SSE4.2+). Hosts like Intel Atom N2800 SIGILL
# in libvips. Install WASM addon explicitly (do NOT use `npm install --cpu=wasm32`,
# which prunes other musl natives e.g. lightningcss) then strip native @img binaries.
# in libvips. Keep @img/sharp-wasm32 (declared dep) and strip native @img binaries
# so sharp cannot load them. Do NOT use `npm install --cpu=wasm32` (prunes lightningcss).
RUN --mount=type=cache,target=/root/.npm \
HUSKY=0 npm ci --prefer-offline --no-audit \
&& npm install --no-save --no-audit --no-fund @img/sharp-wasm32@0.35.4 \
&& find node_modules/@img -mindepth 1 -maxdepth 1 -type d \( \
-name 'sharp-linux*' -o -name 'sharp-libvips-*' \
\) -exec rm -rf {} +
\) -exec rm -rf {} + \
&& test -f node_modules/@img/sharp-wasm32/lib/sharp-wasm32-0.35.4.node.wasm

# ── Étape 2 : build ───────────────────────────────────────────────────────────
FROM deps AS builder
Expand Down Expand Up @@ -46,8 +46,12 @@ RUN addgroup --system --gid 1111 hobbyhoops \
COPY --from=builder /app/public ./public
COPY --from=builder --chown=hobbyhoops:hobbyhoops /app/.next/standalone ./
COPY --from=builder --chown=hobbyhoops:hobbyhoops /app/.next/static ./.next/static
# Standalone tracing may omit dynamically loaded .wasm; force-copy sharp WASM runtime.
COPY --from=builder --chown=hobbyhoops:hobbyhoops /app/node_modules/@img/sharp-wasm32 ./node_modules/@img/sharp-wasm32
COPY --from=builder --chown=hobbyhoops:hobbyhoops /app/node_modules/@emnapi ./node_modules/@emnapi

RUN mkdir -p /app/data && chown hobbyhoops:hobbyhoops /app/data
RUN test -f /app/node_modules/@img/sharp-wasm32/lib/sharp-wasm32-0.35.4.node.wasm

COPY --chmod=755 scripts/docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh
COPY --chmod=755 scripts/docker-ensure-db.mjs /app/scripts/docker-ensure-db.mjs
Expand Down
8 changes: 8 additions & 0 deletions next.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,14 @@ const nextConfig: NextConfig = {
output: "standalone",
poweredByHeader: false,
serverExternalPackages: ["better-sqlite3", "sharp"],
// Standalone tracing often omits sharp's dynamically loaded .wasm / natives.
outputFileTracingIncludes: {
"/**": [
"./node_modules/sharp/**/*",
"./node_modules/@img/sharp-wasm32/**/*",
"./node_modules/@emnapi/**/*",
],
},
turbopack: {
root: projectRoot,
},
Expand Down
3 changes: 1 addition & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
},
"dependencies": {
"@base-ui/react": "^1.8.0",
"@img/sharp-wasm32": "0.35.4",
"@tanstack/react-table": "^9.1.2",
"better-sqlite3": "^13.0.3",
"class-variance-authority": "^0.7.1",
Expand All @@ -45,10 +46,10 @@
"react-dom": "19.2.8",
"recharts": "^3.10.1",
"server-only": "^0.0.1",
"sharp": "0.35.4",
"tailwind-merge": "^3.6.0",
"tw-animate-css": "^1.4.0",
"zod": "^4.5.4",
"sharp": "0.35.4"
"zod": "^4.5.4"
},
"devDependencies": {
"@commitlint/cli": "^21.2.2",
Expand Down