fix: nginx proxy URI, SW cache, sw.js no-cache

This commit is contained in:
Claude
2026-05-01 07:53:56 +02:00
parent 16820c5c14
commit e67574f1c6
8 changed files with 45 additions and 6 deletions
+10 -1
View File
@@ -44,4 +44,13 @@ ENV PORT=3001
# JWT_SECRET doit être injecté via variable d'environnement au runtime
HEALTHCHECK --interval=30s --timeout=10s --start-period=20s --retries=3 \
CMD wget -qO- http://localhost:
CMD wget -qO- http://localhost:3001/api/health || exit 1
EXPOSE 3001
# Volume pour SQLite DB + uploads (persistant entre les redémarrages)
VOLUME ["/app/data"]
# ts-node --transpile-only : contourne les erreurs de compilation tsc
# (dist/index.js produit par tsc est tronqué sur certains environnements Alpine)
CMD ["node_modules/.bin/ts-node", "--transpile-only", "src/index.ts"]
+3 -1
View File
@@ -34,4 +34,6 @@
"@types/uuid": "^10.0.0",
"drizzle-kit": "^0.22.7",
"ts-node-dev": "^2.0.0",
"typescript": "^5.4
"typescript": "^5.4.5"
}
}
+14 -1
View File
@@ -58,4 +58,17 @@ if (fs.existsSync(publicDir)) {
// Manifeste PWA — pas de cache long
app.get(/\.webmanifest$/, (_req, res, next) => {
res.setHeader('Cache-Control', 'no-cache, no-store, must-revalidate')
res.set
res.setHeader('Expires', '0')
next()
})
app.use(express.static(publicDir))
app.get('*', (_req, res) => res.sendFile(path.join(publicDir, 'index.html')))
}
// ─── Start ────────────────────────────────────────────────────────────────────
app.listen(PORT, () => {
console.log(`✓ ShootTracker backend → http://localhost:${PORT}`)
console.log(` Uploads : ${UPLOADS_DIR}`)
console.log(` AI : ${process.env.AI_SERVICE_URL || 'http://localhost:8000'}`)
})
+2 -1
View File
@@ -168,4 +168,5 @@ exportRouter.get('/excel', (req: AuthRequest, res) => {
const filename = `shoottracker_${format(new Date(), 'yyyy-MM-dd')}.xlsx`
res.setHeader('Content-Type', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet')
res.setHeader('Content-Disposition', `attachment; filename="${filename}"`)
res.send(XLSX.write(wb, { type: 'buffer', bookType:
res.send(XLSX.write(wb, { type: 'buffer', bookType: 'xlsx' }))
})
+1
View File
@@ -16,3 +16,4 @@
},
"include": ["src/**/*"],
"exclude": ["node_modules", "dist"]
}
+10 -1
View File
@@ -56,4 +56,13 @@ services:
- yolo_models:/root/.config/Ultralytics
healthcheck:
test: ["CMD", "wget", "-qO-", "http://localhost:8000/health"]
interval:
interval: 30s
timeout: 15s
retries: 3
start_period: 60s
volumes:
shoottracker_data:
driver: local
yolo_models:
driver: local
Binary file not shown.
+5 -1
View File
@@ -47,4 +47,8 @@ export default defineConfig({
'/uploads': { target: 'http://localhost:3001', changeOrigin: true }
}
},
build:
build: {
outDir: 'dist',
sourcemap: false
}
})