mirror of
https://github.com/UniversityOfHelsinkiCS/oodikone.git
synced 2026-10-12 19:03:39 +03:00
[Vite] Add vite cache dir to frontend to fix permission errors
This commit is contained in:
@@ -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 .
|
||||
|
||||
@@ -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/': {
|
||||
|
||||
Reference in New Issue
Block a user