This commit is contained in:
cangui 2025-08-18 19:21:56 +02:00
parent 7b01b1b928
commit 21d42d17b7
2 changed files with 10 additions and 4 deletions

View File

@ -14,6 +14,7 @@ RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-ins
ca-certificates tzdata busybox && rm -rf /var/lib/apt/lists/* ca-certificates tzdata busybox && rm -rf /var/lib/apt/lists/*
WORKDIR /app WORKDIR /app
COPY --from=builder /out/shelfy /app/shelfy COPY --from=builder /out/shelfy /app/shelfy
COPY --from=builder /src/web /app/web # <-- AJOUT
RUN mkdir -p /app/data /app/upload /var/log/shelfy \ RUN mkdir -p /app/data /app/upload /var/log/shelfy \
&& chmod -R 0775 /app /var/log/shelfy && chmod -R 0775 /app /var/log/shelfy
ENTRYPOINT ["/bin/sh","-lc","/app/shelfy 2>&1 | tee -a /var/log/shelfy/shelfy.log"] ENTRYPOINT ["/bin/sh","-lc","/app/shelfy 2>&1 | tee -a /var/log/shelfy/shelfy.log"]

13
main.go
View File

@ -240,12 +240,16 @@ func startHTTP() {
routes.AddRoutes(api, bd) routes.AddRoutes(api, bd)
utils.CreateDefaultFolder(bd) utils.CreateDefaultFolder(bd)
// Sert tout le dossier /app/web à la racine // Sert tes fichiers statiques sous /static
app.StaticFS("/", gin.Dir("./web", true)) app.Static("/static", "./web")
// (Optionnel) fallback SPA si tu as un router côté front // Sert l'index sur "/" explicitement
app.GET("/", func(c *gin.Context) {
c.File("./web/index.html")
})
// Fallback SPA : toute route non-API renvoie index.html
app.NoRoute(func(c *gin.Context) { app.NoRoute(func(c *gin.Context) {
// Laisse passer les 404 d'API
if strings.HasPrefix(c.Request.URL.Path, "/api/") { if strings.HasPrefix(c.Request.URL.Path, "/api/") {
c.JSON(404, gin.H{"error": "Not found"}) c.JSON(404, gin.H{"error": "Not found"})
return return
@ -257,6 +261,7 @@ func startHTTP() {
_ = app.Run(":8080") _ = app.Run(":8080")
} }
func main() { func main() {
// SFTP sur 2222 (root = ./upload) // SFTP sur 2222 (root = ./upload)
go startSFTPServer(SFTPBaseDir) go startSFTPServer(SFTPBaseDir)