diff --git a/services/frontend/dev.Dockerfile b/services/frontend/dev.Dockerfile index 74bc759ba..1ac2ac1d0 100644 --- a/services/frontend/dev.Dockerfile +++ b/services/frontend/dev.Dockerfile @@ -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 . diff --git a/services/frontend/vite.config.ts b/services/frontend/vite.config.ts index 52be5d3a0..e48337902 100644 --- a/services/frontend/vite.config.ts +++ b/services/frontend/vite.config.ts @@ -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/': {