[Vite] Add vite cache dir to frontend to fix permission errors

This commit is contained in:
Aaro Koivukangas
2026-10-06 09:06:33 +03:00
parent 5f96b20936
commit c3f776c9ea
2 changed files with 6 additions and 0 deletions
+3
View File
@@ -1,6 +1,9 @@
FROM registry.access.redhat.com/ubi10/nodejs-24-minimal
ENV TZ="Europe/Helsinki"
# Default install location is node_modules/.vite which is not writable
# by user 1001 when binding the local files to the container
ENV VITE_CACHE_DIR=/tmp/vite
WORKDIR /opt/app-root/shared
COPY ./shared .
+3
View File
@@ -6,6 +6,7 @@ import path from 'path'
import { defineConfig } from 'vite'
const inStaging = process.env.REACT_APP_STAGING === 'true'
const viteCacheDir = process.env.VITE_CACHE_DIR ?? 'node_modules/.vite'
// https://vitejs.dev/config/
// eslint-disable-next-line import-x/no-unused-modules, import-x/no-default-export
@@ -38,6 +39,8 @@ export default defineConfig({
}),
],
base: inStaging ? '/oodikone' : '/',
// Docker runs as DOCKER_UID, which may not have write access to the node_modules volume
cacheDir: viteCacheDir,
server: {
proxy: {
'/api/': {