fix: nginx proxy URI, SW cache, sw.js no-cache
This commit is contained in:
+10
-1
@@ -44,4 +44,13 @@ ENV PORT=3001
|
|||||||
# JWT_SECRET doit être injecté via variable d'environnement au runtime
|
# JWT_SECRET doit être injecté via variable d'environnement au runtime
|
||||||
|
|
||||||
HEALTHCHECK --interval=30s --timeout=10s --start-period=20s --retries=3 \
|
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"]
|
||||||
|
|||||||
@@ -34,4 +34,6 @@
|
|||||||
"@types/uuid": "^10.0.0",
|
"@types/uuid": "^10.0.0",
|
||||||
"drizzle-kit": "^0.22.7",
|
"drizzle-kit": "^0.22.7",
|
||||||
"ts-node-dev": "^2.0.0",
|
"ts-node-dev": "^2.0.0",
|
||||||
"typescript": "^5.4
|
"typescript": "^5.4.5"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
+14
-1
@@ -58,4 +58,17 @@ if (fs.existsSync(publicDir)) {
|
|||||||
// Manifeste PWA — pas de cache long
|
// Manifeste PWA — pas de cache long
|
||||||
app.get(/\.webmanifest$/, (_req, res, next) => {
|
app.get(/\.webmanifest$/, (_req, res, next) => {
|
||||||
res.setHeader('Cache-Control', 'no-cache, no-store, must-revalidate')
|
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'}`)
|
||||||
|
})
|
||||||
|
|||||||
@@ -168,4 +168,5 @@ exportRouter.get('/excel', (req: AuthRequest, res) => {
|
|||||||
const filename = `shoottracker_${format(new Date(), 'yyyy-MM-dd')}.xlsx`
|
const filename = `shoottracker_${format(new Date(), 'yyyy-MM-dd')}.xlsx`
|
||||||
res.setHeader('Content-Type', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet')
|
res.setHeader('Content-Type', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet')
|
||||||
res.setHeader('Content-Disposition', `attachment; filename="${filename}"`)
|
res.setHeader('Content-Disposition', `attachment; filename="${filename}"`)
|
||||||
res.send(XLSX.write(wb, { type: 'buffer', bookType:
|
res.send(XLSX.write(wb, { type: 'buffer', bookType: 'xlsx' }))
|
||||||
|
})
|
||||||
|
|||||||
@@ -16,3 +16,4 @@
|
|||||||
},
|
},
|
||||||
"include": ["src/**/*"],
|
"include": ["src/**/*"],
|
||||||
"exclude": ["node_modules", "dist"]
|
"exclude": ["node_modules", "dist"]
|
||||||
|
}
|
||||||
|
|||||||
+10
-1
@@ -56,4 +56,13 @@ services:
|
|||||||
- yolo_models:/root/.config/Ultralytics
|
- yolo_models:/root/.config/Ultralytics
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: ["CMD", "wget", "-qO-", "http://localhost:8000/health"]
|
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.
@@ -47,4 +47,8 @@ export default defineConfig({
|
|||||||
'/uploads': { target: 'http://localhost:3001', changeOrigin: true }
|
'/uploads': { target: 'http://localhost:3001', changeOrigin: true }
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
build:
|
build: {
|
||||||
|
outDir: 'dist',
|
||||||
|
sourcemap: false
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user