Phase 9: containerise & deploy to Portainer

This commit is contained in:
Jānis Kacēns
2026-05-11 16:57:19 +03:00
parent 2477130dd9
commit 6b486a558a
5 changed files with 100 additions and 1 deletions
+16
View File
@@ -26,6 +26,11 @@ import (
)
func main() {
if len(os.Args) > 1 && os.Args[1] == "healthcheck" {
runHealthcheck()
return
}
cfg := config.Load()
logger := slog.New(slog.NewJSONHandler(os.Stdout, nil))
@@ -127,6 +132,17 @@ func main() {
slog.Info("server stopped")
}
func runHealthcheck() {
port := os.Getenv("PORT")
if port == "" {
port = "8080"
}
resp, err := http.Get("http://localhost:" + port + "/healthz")
if err != nil || resp.StatusCode != http.StatusOK {
os.Exit(1)
}
}
func ensureIcons(dir string) {
for _, size := range []int{192, 512} {
path := filepath.Join(dir, fmt.Sprintf("icon-%d.png", size))