Fix prod docker build: native modules and frontend devDeps

Per-package onlyBuiltDependencies so pnpm 10 actually compiles native
modules (isolated-vm, argon2, sqlite3, sharp) — root workspace config
isn't visible when compose mounts a single package into /app.

Frontend container now installs with devDeps (so tsc/vite exist),
prunes after build, and gains a `start` script that serves the build
via vite preview on 0.0.0.0:3000.

Drop obsolete compose `version` key.
This commit is contained in:
2026-04-23 21:52:22 +04:00
parent b481531301
commit 39460df61d
3 changed files with 16 additions and 3 deletions

View File

@@ -18,5 +18,13 @@
"devDependencies": { "devDependencies": {
"nodemon": "3.1.14", "nodemon": "3.1.14",
"uuid": "14.0.0" "uuid": "14.0.0"
},
"pnpm": {
"onlyBuiltDependencies": [
"argon2",
"isolated-vm",
"sharp",
"sqlite3"
]
} }
} }

View File

@@ -1,5 +1,3 @@
version: '3'
networks: networks:
main: main:
external: true external: true
@@ -48,8 +46,9 @@ services:
- | - |
npm i -g pnpm npm i -g pnpm
cd /app cd /app
pnpm install --production pnpm install --frozen-lockfile
sleep 10 sleep 10
rm -f .env rm -f .env
pnpm run build pnpm run build
pnpm prune --prod
pnpm run start pnpm run start

View File

@@ -12,6 +12,7 @@
"dev": "vite", "dev": "vite",
"build": "tsc -b && vite build", "build": "tsc -b && vite build",
"preview": "vite preview", "preview": "vite preview",
"start": "vite preview --host 0.0.0.0 --port 3000",
"typecheck": "tsc -b --noEmit", "typecheck": "tsc -b --noEmit",
"format": "prettier --ignore-unknown --write .", "format": "prettier --ignore-unknown --write .",
"format:check": "prettier --check ." "format:check": "prettier --check ."
@@ -46,5 +47,10 @@
"tailwindcss": "4.2.4", "tailwindcss": "4.2.4",
"typescript": "6.0.3", "typescript": "6.0.3",
"vite": "8.0.10" "vite": "8.0.10"
},
"pnpm": {
"onlyBuiltDependencies": [
"esbuild"
]
} }
} }