Compare commits
24 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
968a20cdc4 | ||
|
|
d14b3ddbc0 | ||
|
|
d44b02607b | ||
|
|
dfa3ef2f64 | ||
|
|
95547217d2 | ||
|
|
8718590bc7 | ||
|
|
363087f25f | ||
|
|
d453fc3637 | ||
|
|
781d54fcec | ||
|
|
b776c658d0 | ||
|
|
6d6f8a7684 | ||
|
|
c066d02074 | ||
|
|
319c48854d | ||
|
|
16a3b0edf7 | ||
|
|
fdd726753b | ||
|
|
760a9c5340 | ||
|
|
157e35c9f9 | ||
|
|
3ba1029b50 | ||
|
|
8b4e2134d6 | ||
|
|
cfbb1caf7b | ||
|
|
fe0024db55 | ||
|
|
3b3c347ce0 | ||
|
|
19351006db | ||
|
|
f150af62f9 |
11
.dockerignore
Normal file
11
.dockerignore
Normal 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
|
||||||
22
Dockerfile
22
Dockerfile
@@ -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;"]
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
29
index.html
29
index.html
@@ -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>
|
||||||
|
|||||||
@@ -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';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user