Files
pca-pijac/docker-compose.yml
Marko Marković 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

63 lines
1.3 KiB
YAML

networks:
main:
external: true
services:
backend:
image: node:22-bookworm
container_name: pca_pijac_backend
restart: unless-stopped
env_file: ./backend/.env.production
working_dir: /repo/backend
networks:
- main
volumes:
- .:/repo
- ./data:/data
labels:
caddy: admin.pca-pijac.dev.civokram.com
caddy.reverse_proxy: '{{upstreams 8055}}'
environment:
CI: "true"
command:
- sh
- -ec
- |
npm i -g pnpm
cd /repo
pnpm install --filter ./backend... --frozen-lockfile --prod
cd /repo/backend
rm -f .env
pnpm exec directus database migrate:latest
pnpm run start
frontend:
image: node:22-bookworm
container_name: pca_pijac_frontend
restart: unless-stopped
env_file: ./frontend/.env.production
working_dir: /repo/frontend
depends_on:
- backend
networks:
- main
volumes:
- .:/repo
labels:
caddy: pca-pijac.dev.civokram.com
caddy.reverse_proxy: '{{upstreams 3000}}'
environment:
CI: "true"
command:
- sh
- -ec
- |
npm i -g pnpm
cd /repo
pnpm install --filter ./frontend... --frozen-lockfile
cd /repo/frontend
sleep 10
rm -f .env
pnpm run build
pnpm run start