wannpassts/backend/cmd/server/main.go
Tronax 38ab90f721
feat(docker): add single-image multi-stage Docker setup with compose
- Multi-stage build: Node builds the frontend, Go builds a static
  CGO-free binary, runtime is Alpine with CA certificates
- Add docker-compose.yml with persistent volume for the SQLite database
- Add .dockerignore to keep the build context slim
- Embed time/tzdata in the Go binary for OS-independent timezones
- Document image build, startup, secrets, and reverse-proxy setup in README
2026-08-25 19:21:27 +02:00

32 lines
740 B
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package main
import (
"log"
"net/http"
// Zeitzonen-Datenbank einbetten macht das Binary unabhängig vom OS (Docker/Distroless)
_ "time/tzdata"
"wannpassts/internal/calendar"
"wannpassts/internal/config"
"wannpassts/internal/db"
"wannpassts/internal/httpapi"
)
func main() {
cfg := config.Load()
database, err := db.Open(cfg.DBPath)
if err != nil {
log.Fatalf("Datenbank konnte nicht geöffnet werden: %v", err)
}
defer database.Close()
syncer := &calendar.Syncer{DB: database, Cfg: &cfg}
srv := httpapi.New(database, &cfg, syncer)
addr := ":" + cfg.Port
log.Printf("WannPassts Backend läuft auf http://localhost%s", addr)
if err := http.ListenAndServe(addr, srv.Router()); err != nil {
log.Fatal(err)
}
}