- 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
32 lines
740 B
Go
32 lines
740 B
Go
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)
|
||
}
|
||
}
|