Compare commits

24 Commits
ok ... main

Author SHA1 Message Date
fcarraUniSa
968a20cdc4 Update .dockerignore 2026-02-18 14:34:50 +01:00
fcarraUniSa
d14b3ddbc0 Update index.html 2026-02-18 14:34:37 +01:00
fcarraUniSa
d44b02607b Update vite.config.ts 2026-02-18 14:34:24 +01:00
fcarraUniSa
dfa3ef2f64 Update Dockerfile 2026-02-18 14:34:10 +01:00
fcarraUniSa
95547217d2 Update Dockerfile 2026-02-18 14:33:56 +01:00
fcarraUniSa
8718590bc7 Update .dockerignore 2026-02-18 14:31:51 +01:00
fcarraUniSa
363087f25f Update index.html 2026-02-18 14:31:35 +01:00
fcarraUniSa
d453fc3637 Update vite.config.ts 2026-02-18 14:31:21 +01:00
fcarraUniSa
781d54fcec Update Dockerfile 2026-02-18 14:24:24 +01:00
fcarraUniSa
b776c658d0 Update Dockerfile 2026-02-18 14:24:07 +01:00
fcarraUniSa
6d6f8a7684 Update index.html 2026-02-18 14:19:55 +01:00
fcarraUniSa
c066d02074 Update vite.config.ts 2026-02-18 14:19:37 +01:00
fcarraUniSa
319c48854d Update Dockerfile 2026-02-18 14:10:15 +01:00
fcarraUniSa
16a3b0edf7 Update Dockerfile 2026-02-18 14:09:51 +01:00
fcarraUniSa
fdd726753b Update Dockerfile 2026-02-18 13:56:46 +01:00
fcarraUniSa
760a9c5340 Update Dockerfile 2026-02-18 13:56:25 +01:00
fcarraUniSa
157e35c9f9 Update Dockerfile 2026-02-18 13:56:07 +01:00
fcarraUniSa
3ba1029b50 Update Dockerfile 2026-02-18 12:38:06 +01:00
fcarraUniSa
8b4e2134d6 Update Dockerfile 2026-02-18 12:37:46 +01:00
fcarraUniSa
cfbb1caf7b Update Dockerfile 2026-02-18 11:01:44 +01:00
fcarraUniSa
fe0024db55 Update Dockerfile 2026-02-18 11:01:15 +01:00
fcarraUniSa
3b3c347ce0 Create .dockerignore 2026-02-18 10:54:13 +01:00
fcarraUniSa
19351006db Update Dockerfile 2026-02-18 10:49:18 +01:00
fcarraUniSa
f150af62f9 Update Dockerfile 2026-02-18 10:48:54 +01:00
5 changed files with 62 additions and 33 deletions

11
.dockerignore Normal file
View File

@@ -0,0 +1,11 @@
node_modules
npm-debug.log
.git
.env
dist
build
backend/node_modules
backend/npm-debug.log
backend/.env
backend/uploads
.DS_Store

View File

@@ -1,28 +1,24 @@
# Build Stage # Build stage
FROM node:20-alpine as build FROM node:20-alpine AS build
WORKDIR /app WORKDIR /app
# Copiamo solo il package.json inizialmente
COPY package.json ./ COPY package.json ./
# PASSAGGIO CRUCIALE: Rimuoviamo eventuali lock file vecchi e forziamo installazione pulita # Install dependencies
RUN rm -rf package-lock.json node_modules
RUN npm install RUN npm install
# Copiamo tutto il resto del codice sorgente
COPY . . COPY . .
# Eseguiamo la build di Vite # Increase memory limit for the build process to 4GB
ENV NODE_OPTIONS="--max-old-space-size=4096"
# Build the application
RUN npm run build RUN npm run build
# Production Stage con Nginx # Production stage
FROM nginx:alpine FROM nginx:alpine
# Copia la configurazione Nginx custom
COPY nginx.conf /etc/nginx/conf.d/default.conf COPY nginx.conf /etc/nginx/conf.d/default.conf
# Copia i file compilati dalla fase di build nella cartella di Nginx
COPY --from=build /app/dist /usr/share/nginx/html COPY --from=build /app/dist /usr/share/nginx/html
EXPOSE 80 EXPOSE 80
CMD ["nginx", "-g", "daemon off;"] CMD ["nginx", "-g", "daemon off;"]

View File

@@ -2,17 +2,13 @@ FROM node:20-alpine
WORKDIR /app WORKDIR /app
# Copiamo il package.json
COPY package.json ./ COPY package.json ./
# PASSAGGIO CRUCIALE: Pulizia e installazione fresca delle dipendenze # Install dependencies
RUN rm -rf package-lock.json node_modules
RUN npm install RUN npm install
# Copiamo il codice sorgente del backend
COPY . . COPY . .
# Creiamo la cartella uploads per evitare errori di permessi
RUN mkdir -p uploads RUN mkdir -p uploads
EXPOSE 3000 EXPOSE 3000

View File

@@ -38,27 +38,26 @@
scrollbar-width: none; scrollbar-width: none;
} }
</style> </style>
<!-- Importmap rimossa per permettere a Vite di gestire le dipendenze React/Markdown dal package.json --> <script type="importmap">
<script type="importmap">
{ {
"imports": { "imports": {
"react-markdown": "https://esm.sh/react-markdown@^10.1.0",
"react-dom/": "https://esm.sh/react-dom@^19.2.4/",
"@vitejs/plugin-react": "https://esm.sh/@vitejs/plugin-react@^5.1.4",
"@google/genai": "https://esm.sh/@google/genai@^1.41.0",
"react/": "https://esm.sh/react@^19.2.4/",
"react": "https://esm.sh/react@^19.2.4", "react": "https://esm.sh/react@^19.2.4",
"path": "https://esm.sh/path@^0.12.7", "react-dom/": "https://esm.sh/react-dom@^19.2.4/",
"react/": "https://esm.sh/react@^19.2.4/",
"@google/genai": "https://esm.sh/@google/genai@^1.41.0",
"react-markdown": "https://esm.sh/react-markdown@^10.1.0",
"lucide-react": "https://esm.sh/lucide-react@^0.574.0", "lucide-react": "https://esm.sh/lucide-react@^0.574.0",
"express": "https://esm.sh/express@^5.2.1",
"mysql2/": "https://esm.sh/mysql2@^3.17.2/",
"multer": "https://esm.sh/multer@^2.0.2",
"cors": "https://esm.sh/cors@^2.8.6",
"fs": "https://esm.sh/fs@^0.0.1-security",
"url": "https://esm.sh/url@^0.11.4",
"vite": "https://esm.sh/vite@^7.3.1", "vite": "https://esm.sh/vite@^7.3.1",
"@vitejs/plugin-react": "https://esm.sh/@vitejs/plugin-react@^5.1.4",
"mysql2/": "https://esm.sh/mysql2@^3.17.2/",
"dotenv": "https://esm.sh/dotenv@^17.3.1", "dotenv": "https://esm.sh/dotenv@^17.3.1",
"crypto": "https://esm.sh/crypto@^1.0.1" "fs": "https://esm.sh/fs@^0.0.1-security",
"path": "https://esm.sh/path@^0.12.7",
"url": "https://esm.sh/url@^0.11.4",
"express": "https://esm.sh/express@^5.2.1",
"cors": "https://esm.sh/cors@^2.8.6",
"crypto": "https://esm.sh/crypto@^1.0.1",
"multer": "https://esm.sh/multer@^2.0.2"
} }
} }
</script> </script>

View File

@@ -11,5 +11,32 @@ export default defineConfig({
changeOrigin: true, changeOrigin: true,
} }
} }
},
build: {
sourcemap: false,
chunkSizeWarningLimit: 1500,
// 'esnext' reduces CPU usage by avoiding heavy transpilation for older browsers
target: 'esnext',
rollupOptions: {
output: {
manualChunks: (id) => {
if (id.includes('node_modules')) {
if (id.includes('react-markdown') || id.includes('remark') || id.includes('rehype')) {
return 'markdown';
}
if (id.includes('lucide-react')) {
return 'icons';
}
if (id.includes('@google/genai')) {
return 'genai';
}
if (id.includes('react') || id.includes('react-dom')) {
return 'react-vendor';
}
return 'vendor';
}
}
}
}
} }
}); });