Compare commits

...

2 Commits

Author SHA1 Message Date
33f52aad6c Allow prod host through vite preview 2026-04-23 22:41:06 +04:00
da8a7f17a4 Make docker startup work on a cold cache
Frontend: tsc was running before vite, but the routeTree.gen.ts that
the routes import is generated by the Vite plugin at startup — fresh
container had no cache, so tsc failed before vite ever ran. Reverse
the order: vite first (generates routeTree), then tsc --noEmit
validates types.

Backend: run `directus database migrate:latest` before start; the
deployed SQLite is on an old schema (Directus 10.x) and `directus
start` aborts on the missing `searchable` column.

Both services: set CI=true so pnpm doesn't prompt for `node_modules`
purge on a non-TTY container, and use `sh -ec` so a failed step halts
the script instead of falling through to `pnpm run start`.
2026-04-23 22:23:26 +04:00
3 changed files with 12 additions and 3 deletions

View File

@@ -17,15 +17,18 @@ services:
labels: labels:
caddy: admin.pca-pijac.dev.civokram.com caddy: admin.pca-pijac.dev.civokram.com
caddy.reverse_proxy: '{{upstreams 8055}}' caddy.reverse_proxy: '{{upstreams 8055}}'
environment:
CI: "true"
command: command:
- sh - sh
- -c - -ec
- | - |
npm i -g pnpm npm i -g pnpm
cd /repo cd /repo
pnpm install --filter ./backend... --frozen-lockfile --prod pnpm install --filter ./backend... --frozen-lockfile --prod
cd /repo/backend cd /repo/backend
rm -f .env rm -f .env
pnpm exec directus database migrate:latest
pnpm run start pnpm run start
frontend: frontend:
@@ -43,9 +46,11 @@ services:
labels: labels:
caddy: pca-pijac.dev.civokram.com caddy: pca-pijac.dev.civokram.com
caddy.reverse_proxy: '{{upstreams 3000}}' caddy.reverse_proxy: '{{upstreams 3000}}'
environment:
CI: "true"
command: command:
- sh - sh
- -c - -ec
- | - |
npm i -g pnpm npm i -g pnpm
cd /repo cd /repo

View File

@@ -10,7 +10,7 @@
"packageManager": "pnpm@10.33.2", "packageManager": "pnpm@10.33.2",
"scripts": { "scripts": {
"dev": "vite", "dev": "vite",
"build": "tsc -b && vite build", "build": "vite build && tsc -b --noEmit",
"preview": "vite preview", "preview": "vite preview",
"start": "vite preview --host 0.0.0.0 --port 3000", "start": "vite preview --host 0.0.0.0 --port 3000",
"typecheck": "tsc -b --noEmit", "typecheck": "tsc -b --noEmit",

View File

@@ -24,6 +24,10 @@ export default defineConfig({
server: { server: {
port: 3000, port: 3000,
}, },
preview: {
port: 3000,
allowedHosts: ['pca-pijac.dev.civokram.com'],
},
build: { build: {
outDir: 'node_modules/.cache/dist', outDir: 'node_modules/.cache/dist',
emptyOutDir: true, emptyOutDir: true,