mirror of
https://github.com/Dvorinka/bizoni.git
synced 2026-06-03 18:22:57 +00:00
efe
This commit is contained in:
+1
-1
@@ -11,5 +11,5 @@ RUN apk add --no-cache ca-certificates \
|
|||||||
# Optional: timezone data for precise Prague time
|
# Optional: timezone data for precise Prague time
|
||||||
# RUN apk add --no-cache tzdata
|
# RUN apk add --no-cache tzdata
|
||||||
COPY --from=build /app/server /app/server
|
COPY --from=build /app/server /app/server
|
||||||
EXPOSE 8080
|
EXPOSE 80
|
||||||
ENTRYPOINT ["/app/server"]
|
ENTRYPOINT ["/app/server"]
|
||||||
|
|||||||
+21
-2
@@ -59,6 +59,14 @@ func dataPath() string {
|
|||||||
return "/app/data/club.json"
|
return "/app/data/club.json"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func staticPath() string {
|
||||||
|
if p := os.Getenv("STATIC_PATH"); p != "" {
|
||||||
|
return p
|
||||||
|
}
|
||||||
|
// Default mount point for the site in the container
|
||||||
|
return "/app/site"
|
||||||
|
}
|
||||||
|
|
||||||
type ClubTable struct {
|
type ClubTable struct {
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
ClubID string `json:"club_id"`
|
ClubID string `json:"club_id"`
|
||||||
@@ -154,12 +162,23 @@ func main() {
|
|||||||
w.Write([]byte(";"))
|
w.Write([]byte(";"))
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// Static file server for the frontend
|
||||||
|
fs := http.FileServer(http.Dir(staticPath()))
|
||||||
|
// Serve common asset prefixes explicitly
|
||||||
|
mux.Handle("/img/", fs)
|
||||||
|
mux.Handle("/css/", fs)
|
||||||
|
mux.Handle("/js/", fs)
|
||||||
|
mux.Handle("/blog/", fs)
|
||||||
|
mux.Handle("/zapasy/", fs)
|
||||||
|
// Fallback: serve index.html and other root-level pages
|
||||||
|
mux.Handle("/", fs)
|
||||||
|
|
||||||
srv := &http.Server{
|
srv := &http.Server{
|
||||||
Addr: ":8080",
|
Addr: ":80",
|
||||||
Handler: mux,
|
Handler: mux,
|
||||||
}
|
}
|
||||||
go func() {
|
go func() {
|
||||||
log.Println("backend listening on :8080")
|
log.Println("server listening on :80")
|
||||||
if err := srv.ListenAndServe(); err != nil && err != http.ErrServerClosed {
|
if err := srv.ListenAndServe(); err != nil && err != http.ErrServerClosed {
|
||||||
log.Fatalf("server error: %v", err)
|
log.Fatalf("server error: %v", err)
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-14
@@ -1,20 +1,10 @@
|
|||||||
services:
|
services:
|
||||||
backend:
|
app:
|
||||||
build: ./backend
|
build: ./backend
|
||||||
container_name: bizoni-backend
|
container_name: bizoni-app
|
||||||
ports:
|
ports:
|
||||||
- "8080:8080"
|
- "80:80"
|
||||||
volumes:
|
volumes:
|
||||||
- ./data:/app/data
|
- ./data:/app/data
|
||||||
restart: unless-stopped
|
- ./:/app/site:ro
|
||||||
web:
|
|
||||||
image: nginx:1.27-alpine
|
|
||||||
container_name: bizoni-web
|
|
||||||
depends_on:
|
|
||||||
- backend
|
|
||||||
ports:
|
|
||||||
- "8088:80"
|
|
||||||
volumes:
|
|
||||||
- ./:/usr/share/nginx/html:ro
|
|
||||||
- ./nginx.conf:/etc/nginx/conf.d/default.conf:ro
|
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
|
|||||||
Reference in New Issue
Block a user