diff --git a/Dockerfile b/Dockerfile index 6f01b32..808c8a7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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/* WORKDIR /app 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 \ && chmod -R 0775 /app /var/log/shelfy ENTRYPOINT ["/bin/sh","-lc","/app/shelfy 2>&1 | tee -a /var/log/shelfy/shelfy.log"] diff --git a/main.go b/main.go index 356ad2e..19f7562 100644 --- a/main.go +++ b/main.go @@ -240,12 +240,16 @@ func startHTTP() { routes.AddRoutes(api, bd) utils.CreateDefaultFolder(bd) - // Sert tout le dossier /app/web à la racine - app.StaticFS("/", gin.Dir("./web", true)) + // Sert tes fichiers statiques sous /static + 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) { - // Laisse passer les 404 d'API if strings.HasPrefix(c.Request.URL.Path, "/api/") { c.JSON(404, gin.H{"error": "Not found"}) return @@ -257,6 +261,7 @@ func startHTTP() { _ = app.Run(":8080") } + func main() { // SFTP sur 2222 (root = ./upload) go startSFTPServer(SFTPBaseDir)