mirror of
https://github.com/swissmakers/fail2ban-ui.git
synced 2026-04-11 13:47:05 +02:00
Fix Dockerfile to include language files
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
# =========================================
|
# =========================================
|
||||||
# STAGE 1: Build Fail2Ban UI Binary
|
# STAGE 1: Build Fail2Ban UI Binary
|
||||||
# =========================================
|
# =========================================
|
||||||
FROM golang:1.22.9 AS builder
|
FROM golang:1.23 AS builder
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
@@ -41,6 +41,7 @@ WORKDIR /config
|
|||||||
COPY --from=builder /app/fail2ban-ui /app/fail2ban-ui
|
COPY --from=builder /app/fail2ban-ui /app/fail2ban-ui
|
||||||
RUN chown fail2ban:0 /app/fail2ban-ui && chmod +x /app/fail2ban-ui
|
RUN chown fail2ban:0 /app/fail2ban-ui && chmod +x /app/fail2ban-ui
|
||||||
COPY --from=builder /app/pkg/web/templates /app/templates
|
COPY --from=builder /app/pkg/web/templates /app/templates
|
||||||
|
COPY --from=builder /app/internal/locales /app/locales
|
||||||
|
|
||||||
# Set environment variables
|
# Set environment variables
|
||||||
ENV CONTAINER=true
|
ENV CONTAINER=true
|
||||||
|
|||||||
@@ -32,12 +32,14 @@ func main() {
|
|||||||
if container {
|
if container {
|
||||||
// In container, templates are assumed to be in /app/templates
|
// In container, templates are assumed to be in /app/templates
|
||||||
router.LoadHTMLGlob("/app/templates/*")
|
router.LoadHTMLGlob("/app/templates/*")
|
||||||
|
router.Static("/locales", "/app/locales")
|
||||||
} else {
|
} else {
|
||||||
// When running locally, load templates from pkg/web/templates
|
// When running locally, load templates from pkg/web/templates
|
||||||
router.LoadHTMLGlob("pkg/web/templates/*")
|
router.LoadHTMLGlob("pkg/web/templates/*")
|
||||||
|
router.Static("/locales", "./internal/locales")
|
||||||
}
|
}
|
||||||
|
|
||||||
// Register all application routes, including the static file serving route for locales.
|
// Register all application routes, including the static files and templates.
|
||||||
web.RegisterRoutes(router)
|
web.RegisterRoutes(router)
|
||||||
|
|
||||||
printWelcomeBanner(serverPort)
|
printWelcomeBanner(serverPort)
|
||||||
|
|||||||
@@ -22,9 +22,6 @@ import (
|
|||||||
|
|
||||||
// RegisterRoutes sets up the routes for the Fail2ban UI.
|
// RegisterRoutes sets up the routes for the Fail2ban UI.
|
||||||
func RegisterRoutes(r *gin.Engine) {
|
func RegisterRoutes(r *gin.Engine) {
|
||||||
// Serve static files for locales from the "internal/locales" directory.
|
|
||||||
// (This makes the translation files available under the /locales/ URL.)
|
|
||||||
r.Static("/locales", "./internal/locales")
|
|
||||||
|
|
||||||
// Render the dashboard
|
// Render the dashboard
|
||||||
r.GET("/", IndexHandler)
|
r.GET("/", IndexHandler)
|
||||||
|
|||||||
Reference in New Issue
Block a user