diff --git a/compose/web/Dockerfile b/compose/web/Dockerfile index b849caa..c2c6249 100644 --- a/compose/web/Dockerfile +++ b/compose/web/Dockerfile @@ -9,6 +9,7 @@ FROM node:22-alpine AS builder WORKDIR /build/web COPY web/package.json web/package-lock.json ./ RUN npm ci +COPY VERSION ./ COPY web/ ./ RUN npm run build diff --git a/web/vite.config.ts b/web/vite.config.ts index b6a7fc2..fe592c5 100644 --- a/web/vite.config.ts +++ b/web/vite.config.ts @@ -1,9 +1,17 @@ import { svelte } from '@sveltejs/vite-plugin-svelte' import tailwindcss from '@tailwindcss/vite' import { defineConfig } from 'vite' -import { readFileSync } from 'fs' +import { readFileSync, existsSync } from 'fs' -const version = readFileSync('../VERSION', 'utf-8').trim() +// In Docker, VERSION is copied into the build WORKDIR (/build/web/VERSION). +// In local dev, the cwd is web/ and VERSION is two dirs up (../../VERSION +// from vite.config.ts location in web/). Try both. +let version: string +if (existsSync('../VERSION')) { + version = readFileSync('../VERSION', 'utf-8').trim() +} else { + version = readFileSync('VERSION', 'utf-8').trim() +} // Injects OIKOS_API_TOKEN into proxied /api requests in dev — the API no // longer has a dev-open bypass (plans/2026-07-12-wails-desktop-app.md 0.4),