fix: VERSION file resolution in Docker build context
- Dockerfile now copies VERSION into /build/web/VERSION for vite - vite.config.ts tries ../VERSION (local dev) then ./VERSION (Docker)
This commit is contained in:
@@ -9,6 +9,7 @@ FROM node:22-alpine AS builder
|
|||||||
WORKDIR /build/web
|
WORKDIR /build/web
|
||||||
COPY web/package.json web/package-lock.json ./
|
COPY web/package.json web/package-lock.json ./
|
||||||
RUN npm ci
|
RUN npm ci
|
||||||
|
COPY VERSION ./
|
||||||
COPY web/ ./
|
COPY web/ ./
|
||||||
RUN npm run build
|
RUN npm run build
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,17 @@
|
|||||||
import { svelte } from '@sveltejs/vite-plugin-svelte'
|
import { svelte } from '@sveltejs/vite-plugin-svelte'
|
||||||
import tailwindcss from '@tailwindcss/vite'
|
import tailwindcss from '@tailwindcss/vite'
|
||||||
import { defineConfig } from '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
|
// 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),
|
// longer has a dev-open bypass (plans/2026-07-12-wails-desktop-app.md 0.4),
|
||||||
|
|||||||
Reference in New Issue
Block a user