llmfit/llmfit-web/vite.config.js
Lee Johnson ed8c1847aa
feat(docker): add multi-stage build (#911)
- Embed frontend dist assets directly into the Rust binary during multi-stage build
- Replace multi-container setup in docker-compose.yml with unified llmfit service
- Revert user provisioning to standard non-root user (UID 1000) and tighten permissions
- Document glibc alignment requirements between rust-builder and runtime Debian stages
- Restrict default allowedHosts in vite.config.js for safer local development
- Remove rust-toolchain.toml to prevent overriding CI pipelines
- Update Docker Compose test assertions to target single embedded service on port 8787
feat(docker): add web frontend service and multi-stage container support
2026-09-01 11:30:09 +01:00

42 lines
1.2 KiB
JavaScript

import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
// Helper to parse comma-separated allowed hosts or default to 'all' / true
const parseAllowedHosts = (envVal) => {
if (!envVal) return false; // Restrictive default to prevent DNS rebinding
if (envVal === 'all' || envVal === 'true') return true;
return envVal.split(',').map((h) => h.trim());
};
export default defineConfig({
plugins: [react()],
preview: {
allowedHosts: parseAllowedHosts(process.env.ALLOWED_HOSTS),
host: process.env.HOST || '0.0.0.0',
port: parseInt(process.env.PORT, 10) || 8787,
proxy: {
'/api': {
target: process.env.VITE_API_BACKEND || 'http://127.0.0.1:8787',
changeOrigin: true
}
}
},
server: {
allowedHosts: parseAllowedHosts(process.env.ALLOWED_HOSTS),
host: process.env.HOST || '0.0.0.0',
port: parseInt(process.env.DEV_PORT, 10) || 5173,
proxy: {
'/api': {
target: process.env.VITE_API_BACKEND || 'http://127.0.0.1:8787',
changeOrigin: true
},
'/health': process.env.VITE_API_BACKEND || 'http://127.0.0.1:8787'
}
},
test: {
environment: 'jsdom',
setupFiles: './src/test-setup.js',
globals: true,
css: true
}
});